GEOG 490/590
GIS Programming
Exercise 7: Vector
Analysis
This exercise lets you practice the use of vector data in
spatial analysis. The exercise covers the two vector analysis lectures we had
this week. The topics include:
- Vector Geometry
- Spatial Query and Selection Set
- Spatial Join
- Vector Buffering
- Vector Overlay
You can use the sample code (Ex7_CodeSample.txt) for this exercise. You will
need to use serveral point, line, and polygon shapefiles for this exercise. You
can download sample data here.
Create an ArcMap add-in and copy and paste the sampe code
into an event can could trigger the individual procedures (e.g., a button on a
dockable window). Or, you can copy the code to a new class and call the
individual procedures from the event control.
- Before you can debug the program, you need to add the required references
and import the namespaces to your project first. Please use online help to
figure out which references and namespaces need to be added.
- The sample code gets the data from layers added to ArcMap. Please add the
layers to ArcMap before executing any code. Some layer names are hard-coded
in the program. They are: aoi_v.shp, aoi_streams.shp, and
stream_points.shp. The names of output shapefiles are also hard-coded in
the program. Please read the sample code for these file names.
- Try the following tasks on individual procedures.
- ShapeGeometry(): calculate the total area of all polygons in the
aoi_v shapefile; calculate the distances among the centroids of the
aoi_v polygons.
- CreateSelectionSet(): perform queries on numeric and text fields.
- CreateSpatialQuery(): different SpatialRel values.
- SpatialJoin(): using layers of different geometric types to perform
different spatial join methods.
- BufferDemo(): perform buffering on selected features only (see the
code in the GetSelectionSet() for the method to get the selectset of a
feature layer).
- VectorOverlay(): try clip. dissolve, merge, and union methods of
BasicGeoprocessor.