ArcObjects Programs

The following links open ArcObjects programs that were written mostly to assist
UCI researchers with their research projects which employ GIS.

Each of these programs, written in VBA, can be downloaded then imported as a
new module within the VBA editor in ArcMap. Download a selected program file
and save it with the .bas suffix. To import a downloaded program, open ArcMap,
click Tools > Macros > Visual Basic Editor then click File > Import File...
Once imported, modify the program to conform to the needs of your project.


Extract Point Elevation Range Values and Apply to Polygons
Using a point layer in the active map which has an attribute of elevation,
intersect the points with a specific rectangularly-gridded polygon layer.
Extract the minimum and maximum elevations of all points within each
cell and then calculate the range. Copy the elevation values to the associated
cell of the polygon layer. This program was written to process USGS GTOPO30
elevation data.
Includes: ConvertRasterToPointDataSet(), GetLayer(), GetBaseName()

Write Total Area of Polygons to File
Cycle through each of the polygon shapefiles in the active data frame, extract the area
value from all the polygons in the [shape] field, sum the values, then write that total
value out with the shapefile name.
Includes: PolygonAreaReport(), GetFullName()

Delete All Fields Except Designated Fields
Deletes all fields in all the feature layers in the active data frame except for a designated
set of fields.
Includes: DeleteFields()

Delete Polygons Below Minimum Size
Cycle through all the polygon shapefiles in the active data frame, extract the area value from
the [shape] field and determine if the target polygon has an area that is below the cutoff value.
If so, delete the polygon.
Includes: PolygonDelete(), GetFullName()

Store Total Area of All Polygons
Cycle through all the polygon shapefiles in the active data frame, extract the area value from
the [shape] field, generate a total for all polygons and store that value in the RangeSize field.
Then calculate the Log10 of the total area and store that value in the LogRange field. First
add the RangeSize field and LogRange field if they currently do not exist.
Includes: RangeSize()

Store Polygon Area As Attribute
Cycle through all the polygon shapefiles in the active data frame, extract the area value from
the [shape] field and store that value in the Area field. First add the Area field if it
currently does not exist.
Includes: PolygonArea()

Export Shapefiles Using Data Frame Projection
Extract the coordinate system information from the active data frame (in ArcObjects,
the focus map) and then cycle through each feature class (or layer) within the
active data frame; assign the projection parameters to the feature class; then save
the feature class out to a new feature class with the saved coordinate system.
Includes: ExportShapefileProject(), ExportFeatureClass(), GetFullName()

Intersect Point Shapefile with Overlapping-polygons Shapefile
Overlay a point layer onto a polygon layer which contains (potentially) multiple,
overlapping polygons. Intersect each of the points in the point layer with each of
the coincident polygons in the polygon layer and write out to a file, one line for
each point, the value of a field associated with a point in the point layer and the
value(s) of a field in the polygon layer, one value for each polygon intersected.
Includes: PtInPolyMultiple(), OnePointInPolygonSelect(), GetLayer(), GetField(),
GetFileName()

Extract Value from Standalone Table and Store in Field
Join to a table and extract the age value associated with a shapefile name and store that
value in the age field. First add the age field if it currently does not exist.
Includes: AddValue(), AddField(), DeleteField(), GetTable(), GetTableValue(),
GetFieldFromTable()

Extract Average Maximum and Minimum Point Attribute Values
Using the point shapefile layers in the active map, cycle through each POINTID attribute in
each layer and extract the (weight) value, specifically GRIDCODE, for all points with that
same POINTID value. Calcluate the average of the top 25% of all the points with the same
POINTID value and which have a value greater than zero. Do the same for the lower 25%
weight values. Generate a table and store the results.
Includes: Ave_of_MaxMinWeights(), dhBubbleSort, dhQuickSort()

Write Values for Selected Field to File
Produce a list of all the fields in the top-most feature class in the TOC then prompt user
to select one of those fields. Cycle through all the feature classes and write to file the
name of each feature class and all the values of the selected field in the feature class.
Includes: CheckFieldValues(), GetField(), GetFullName()

Intersect Points and Generate Raster
Using the point layers in the active map, cycle through each point in each layer and
intersect the points with a series of five rectangularly-gridded polygon layers each
at a different polygon size. Generate a raster from the target polygon layer.
Includes: PointBird2Raster(), GetFullName(), AssignFieldValue()

Build a Set of Orthogonal Polygon Shapefiles
This program is used to produce a series of five orthogonal polygon shapefiles and five
point shapefiles at five cell sizes. Each of the shapefiles has the same extent and the
edges are evenly divisible by 440000 units (such as Km).
Includes: MakePolygonBase(), BuildOrthogonalPolygonShapefile(),
AddFeatureLayerFromGeodataset(), GetFullName()

Sum Polygons to Grid Cells
Using a polygon layer in the active map, intersect the polygons with a specific
rectangularly-gridded polygon layer. Calculate the summation value of some field of all
the polygons within each grid and store that value in the gridded polygon layer.
Includes: poly_in_poly_sum()

Conflate Polygons
Conflates polygons from one polygon layer to the sole polygon of a reference polygon layer.
Includes: Conflation(), AssembleControlPoints(), GetBiggestPolygon()

Shift Features Based On User-defined Offset Values
Shift all the features of all the selected shapefiles or feature classes an amount in
the X- and Y-coordinate directions indicated by the user through the "Move" dialog.
Includes: FeatureShift()

Extract Polygon Value
Using the polygon layers in the active map, cycle through each polygon in each layer and
intersect the polygons with a choice of one of a series of five rectangularly gridded polygon
layers each at a different polygon size. Extract the value associated with the bird polygons.
Generate a raster from the target polygon layer.
Includes: Bird_Age(), GetFullName()

Move Points By Reducing Their Coordinate Precision
This program truncates the coordinate positions of points in a point layer by first dividing
the X coordinate by 100, creating an integer out of the new value (thus losing the fractional
portion, then multipying by 100 to restore the approximate position. Then do the same for the
Y coordinate. Procedure is useful in making maps which approximately show where people live
starting from data which do show where they live.
Includes: MovePointsByTruncate(), TestRandom()

Sum Rasters
Perform a summation on all the rasters in the selected workspace. Store the resultant
summation as a new raster.
Includes: SumRastersInWorkspace(), GetRasterWorkspace(), GetRasterDataset(), GetFullName()

Polygon Intersect to DBF File
Using the polygon layers in the active map, cycle through each polygon in each layer
and intersect the polygons with a rectangularly gridded polygon layer each at a different
polygon size. Generate a dbf file of the "GRIDCODE" values from the target polygon layer.
Includes: PolyIntersectToDBF(), GetFullName()

Sum Points Within Polygons
Overlay a point layer with a polygon layer in the active map. Sum all the points falling
within each polygon and store that value in a field in the polygon layer.
Includes PointInPolygonSelect(), GetLayer(), GetField()

Point In Polygon Field Average
Using a point layer in the active map, intersect the points with a specific
rectangularly-gridded polygon layer. Calculate the average value of some field of all
the points within each grid and store that value in the polygon layer. Apply a minimum
cutoff value for the points that will go into the average.
Includes: PtInPolyAverage(), PointInPolygonSelect(), GetLayer(), GetField()

Intersect Polygons and Generate Raster
Using the polygon layers in the active map, cycle through each polygon in each layer and
intersect the polygons with a series of five rectangularly gridded polygon layers each at
a different polygon size. Generate a raster from the target polygon layer.
Includes: Bird2Raster(), GetFullName()

Raster Cell Allocation
Perform a series of spatial analyst operations to get the allocation of raster cells
to lines that are created using the centers of pavement fractures depicted in an image
Includes:DoAllocation(), GetAllocationDataSet(), GetReclassDataset(), GetThinDataset(),
GetDSPolyline(), DeleteFeatureDS()

Functions Library
A library of ArcObjects functions and subroutines. Functions and subroutines include:
GetLayer() - Canvas the Table of Contents and put up a dialog of candidates
and return the layer name.
GetField() - Canvas the designated layer for its fields, put up a dialog of
candidate fields, and return the desired field name.
GetFieldFromTable() - Canvas the designated standalone table for its fields,
put up a dialog of candidate fields, and return the desired field name.
PointInPolygonSelect() - Select all the polygons in a polygon feature layer that
overlay any points within a point feature layer.
PolygonOverPointSelect() - Select all the polygons in a polygon feature layer
that overlay any points within a point feature layer.
ConvertProjectedToGeographic() - Project a coordinate set from the projection
used in the focus map to Geographic coordinates.

Generate Earthquake Moment Tensor Solutions
Create a earthquake epicenter Moment Tensor Solution polygon given x,y coordinates,
and two strike, dip and slip components.
Includes: MomentTensor(), PlotMomentTensor(), DoMomentTensor(), OpenMTSTable()