GEOG 490/590

GIS Programming

Exercise 4: Layer symbology

This exercise lets you practice the manipulation of layer symbology and the use of ArcGIS' Style Gallery and renderer. You can use the sample code (Ex4_CodeSample.txt) for this exercise. You will need to use a line shapefile and a integer raster grid 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. Or, you can copy the code to a new class and call the individual procedures from the event control.

  1. 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.

  2. There are three methods defined in the sample code: ChangeLineColor(), ChangeLineStyle(), and DisplayRaster(). Before you call the procedures, make sure you add the matching layers to ArcMap first. You shouldn't use the ChangeLineColor on a point or a polygon feature class, nor a raster layer. You can modify the code to handle unexpected situtation (e.g., no layers in the data frame). (hint: check the number of layers in ArcMap first.)
  3. Try to use a different color or width in the ChangeLineColor procedure. Try to use a different line or color ramp style in the ChangeLineStyle and DisplayRaster procedure.
  4. If you want to check the geometry of a feature layer so that you can use the matching symbol type (point, line, or polygon), you can cast the layer to the IFeatureClass interface and use IFeatureClass.ShapeType to see if the geometry of the layer matches the symbol type. More about IFeatureClass here.