This document is archived and information here might be outdated.  Recommended version.


Working with layers and renderers (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Interacting with and configuring maps, layers, and graphics > Working with layers and renderers

Working with layers and renderers


Summary
This topic provides an overview of layers and renderers in ArcGIS.

In this topic

  • Layers
  • Renderers

    Layers

    Layers display geographic information on a map. A layer does not store the actual geographic data; rather, it references the data contained in geodatabases, coverages, shapefiles, raster datasets, grids, and so on, then defines how to display this geographic data. Some layers do not refer to geographic data. For example, a GroupLayer contains other layers and a CompositeGraphicsLayer stores graphics.
    Each type of layer object represents different types of data. Examples of layer objects include the following:
    The Layers page of the Carto Object Model Diagram (OMD) is a good place to start for an understanding of the different layer classes and the properties and methods that they support.
    The following table gives a brief description of each layer component in the Carto library:
    Layer
    Description
    A type of group layer with an optimized drawing path for performance.
    Displays CAD annotation.
    Displays CAD data as features.
    Displays CAD data as a CAD drawing.
    CompositeGraphicsLayer
    A collection of graphics layers that behaves like a single layer.
    CoverageAnnotationLayer
    An Esri coverage annotation layer.
    Displays geodatabase dimension features.
    Displays graduated marker legend items in the style gallery.
    Displays legend items in the style gallery.
    Displays geodatabase annotation features.
    Displays annotation features in a subset of a geodatabase annotation feature class.
    FeatureLayer
    Displays vector features - for example, stored in geodatabase feature classes, shapefiles, and coverages.
    Displays raster catalog data stored in a geodatabase.
    Graphic sublayer handed back by a CompositeGraphicsLayer.
    GroupLayer
    A collection of layers that behaves like a single layer.
    Displays IMS data.
    A feature sublayer of an IMSMapLayer.
    A sublayer of an IMSMapLayer.
    A basic MapServerLayer sublayer.
    A MapServerLayer sublayer with find capability.
    A MapServerLayer sublayer with identify capability.
    Displays ArcGIS Map Server data.
    A MapServerLayer sublayer with find and identify capability.
    Displays mosaic datasets.
    Displays network datasets.
    Displays rasters via an optimized drawing path for performance.
    Displays raster catalog data.
    RasterLayer
    Displays raster data.
    Displays terrain data.
    TinLayer
    Displays TIN data.
    Displays a geodatabase topology as a layer.
    A group sublayer of a WMSMapLayer.
    A sublayer of a WMSMapLayer.
    Displays WMS services as layers.
    For an example of how to create and add layers for different data types, see How to add different types of layers to a map.

    Accessing layers

    The Map object manages a collection of layers. You can use the Layer or the Layers property on the IMap interface to get a reference to a layer. To determine the type of layer to which you have a reference, cast to specific interfaces. For example, if the layer object supports the ITinLayer interface, then you know it is a TinLayer object or a custom object that implements the interface. Layers can be persisted separately from maps in layer files (.lyr). The LayerFile class provides capabilities for reading and writing .lyr files

    Accessing a layer's underlying data

    Depending on the type of layer with which you are working, you use a different interface to access the layer's underlying data source. In some cases, this interface is different for each type of layer - for example, for RasterLayer, use IRasterLayer.Raster to access the underlying data for the layer. You can also use IGeoFeatureLayer to access layer data. A GroupLayer has no direct data source; instead, it refers to other layers. Access these layers via ICompositeLayer.
    For more information, see How to access a layer's underlying data.

    Layer abstract class

    Conceptually, all layers inherit from an abstract class called Layer. The Layer class implements the following interfaces:
    You can see this abstract class on the Layers page of the Carto OMD.
    The ILayer interface has methods to draw the layer and properties to define the extent of the layer, the minimum and maximum display scale, the spatial reference, the name, the supported draw phases, and the map tip text. There are also properties that indicate whether the layer is visible, valid, or cached, and whether or not the layer shows MapTips.
    The Cached property indicates whether or not the layer requires its own display cache. If Cached is set to true, the map gives a separate display cache to the layer so it can be refreshed independently of other layers. A tracking layer is an example of a custom layer that would set the Cached property to true because it may require to be refreshed more frequently than the rest of the map.
    The SpatialReference property is used only for the map display; it does not change the spatial reference of the underlying data. It carries the Map object's knowledge of the current on-the-fly projection back to the feature layer.
    The IGeoDataset interface specifies the extent and spatial reference of the underlying data. The SpatialReference property on IGeoDataset is read-only. The property is used to set the spatial reference of the map; the map's spatial reference is automatically set to the spatial reference of the first layer loaded.
    ILayerGeneralProperties provides access to a text description of the layer as well as properties for the previous maximum and minimum visibility scales for the layer.IPublishLayer provides access to properties and methods for publishing the layer using the ArcGIS Publisher extension. The persistence interfaces allow a layer to be saved and loaded from disk as part of a .lyr or .mxd file.

    Creating a custom layer

    You can write a custom layer to support an unsupported data type in ArcGIS or to change how a supported data type draws and behaves in ArcMap and other ArcGIS applications. To aid in the development of a custom layer, a .NET base class is available in the Application Developer Framework (ADF) assemblies. For more information, see BaseCustomLayer.

    Renderers

    The ArcGIS renderer classes and interfaces are found mainly in the Carto library. Renderers are objects that store symbolization for ArcGIS data layers and draw the data based on the stored symbolization rules. Layer classes and interfaces are also mainly in the Carto library. The renderer objects are divided into the following main groups:
    • Feature renderers - Objects that render feature data
    • Raster renderers - Objects that render raster data
    • TIN renderers - Objects that render three-dimensional (3D) triangular irregular network (TIN) data
    Renderers are assigned to layers using different interfaces depending on whether you are working with feature, raster, or TIN data. See the following sections covering the different renderer groups for details. After changing a layer's renderer properties, or after assigning a new renderer to a layer, update the display by performing a partial refresh of the display.
    Most renderers store symbol objects and use the objects to draw layers. Symbol classes and interfaces are mainly in the Display library. To assign or retrieve a renderer's symbols, use the specific interface for your particular renderer. For example, if you're working with ClassBreaksRenderer, use IClassBreaksRenderer.Symbol; for RasterUniqueValueRenderer, use IRasterUniqueValueRenderer.Symbol; for TinElevationRenderer, use ITinColorRampRenderer.Symbol.

    Feature renderers

    Feature renderers are used to symbolize feature layers. A number of different feature renderer classes are available. The following table lists the different feature renderer types and what they are used for along with a simple picture showing the renderer in use:
    Type
    Description
    Use
    Each feature in the layer is symbolized with the same symbol.
    Features are drawn with different symbols depending on the unique values of one or more attribute fields.
    ClassBreaksRenderer
    Features are drawn with graduated color (choropleth) or graduated size symbolization based on values in an attribute field. The data value range is divided into classes, each feature having membership in only one of these classes based on its attribute value. Features are drawn with the symbol corresponding to their class.
    Features are drawn with proportionally sized symbols based on values in an attribute field.
    Polygon features are drawn with randomly placed dots where the dot count for each feature represents the value of an attribute field.
    Features are drawn with pie, bar, and stacked bar charts. Chart content is based on values stored in one or more attribute fields.
    Features are drawn with a symbolization that is a combination of a UniqueValueRenderer and a ClassBreaksRenderer. Values from separate, orthogonal attribute fields generate a single symbolization based on these two components.
    A renderer that draws features using representation information stored in the layer's data source.
    A renderer that is comprised of multiple renderers, each operating only within a particular scale range.
    No picture
    • Accessing feature renderers - Each feature layer is assigned only one feature renderer. To get a feature renderer object from a layer, use IGeoFeatureLayer.Renderer. To set a renderer to a layer, use the same property. For more information on how to modify and set FeatureRenderers, see Defining a renderer for a layer.
    • FeatureRenderer abstract class - Conceptually, all feature renderer classes inherit from an abstract class called FeatureRenderer. You can implement your own feature renderer by implementing all the interfaces implemented by this class. You can see this abstract class on the Layers page of the Carto OMD.

      FeatureRenderer implements IFeatureRenderer, which provides access to properties and methods common to all feature renderers. This base class also implements persistence interfaces that allow feature renderers to be saved and loaded from disk as part of .lyr and .mxd files. All feature renderers should also implement ILegendInfo, which provides access to a renderer's legend information and symbols. All Esri feature renderers have at least one LegendGroup, which in turn has at least one LegendClass.

      Though feature renderers typically store all the symbols they use to draw features in their LegendClass objects, it is best to access these symbols via the specific renderer interface for the renderer object you're using. For example, for ClassBreaksRenderer, use IClassBreaksRenderer.Symbol, or for ProportionalSymbolRenderer, use IProportionalSymbolRenderer.MinSymbol and IProportionalSymbolRenderer.BackgroundSymbol. Although ILegendInfo is also implemented by most layer classes, layers typically defer all methods and properties to the renderer's implementation.

    Raster renderers

    Raster renderers are used to symbolize raster layers. A number of different raster renderer classes are available. The following table displays a list of the raster renderer types along with an explanation of their use:
    Type
    Description
    Pixels are drawn with graduated color symbolization based on their value. The data value range is divided into classes, each pixel having membership in only one of these classes based on its value. Pixels are drawn with the color corresponding to their class.
    The raster layer is drawn based on a color map.
    A renderer for drawing raster layers in true-color RGB. The renderer draws three bands of a raster dataset, one for each of the red, green, and blue channels.
    A renderer for rasters with continuous values. The raster layer is drawn using a color ramp stretched across these values.
    RasterUniqueValueRenderer
    Pixels are drawn with a different color for each unique value in the raster layer.
    • RasterRenderer abstract class - All raster renderer classes conceptually inherit from an abstract class called RasterRenderer. You can implement your own raster renderer by implementing all the interfaces implemented by this class.

      RasterRenderer implements IRasterRenderer, which provides access to properties and methods common to all raster renderers. This base class also implements persistence interfaces that allow raster renderers to be saved and loaded from disk as part of .lyr and .mxd files. Raster renderers implement ILegendInfo, which provides access to a renderer's legend information and symbols.

      Esri raster renderers typically store the symbols they use to draw raster data in LegendClass objects that can be accessed via ILegendInfo. However, when writing client code that works with a raster renderer, it is best practice to access and change a renderer's symbols using the interface specific to the renderer you're using. For example, if working with RasterUniqueValueRenderer, use IRasterUniqueValueRenderer.Symbol, or if using RasterStretchColorRampRenderer, use IRasterStretchColorRampRenderer.ColorRamp. Although ILegendInfo is also implemented by most layer classes, layers typically defer all methods and properties to the renderer's implementation. All raster renderers also expose display properties and methods through IDisplayAdmin and IRasterDisplayProps.

    TIN renderers

    TIN renderers are used to symbolize TIN and Terrain layers. A number of different TIN renderer classes are available. Unlike raster and feature layers and renderers, each TIN or Terrain layer can be symbolized by more than one of these objects at the same time. The Esri TIN renderer objects are divided into renderers that symbolize nodes, edges, and faces. These renderer objects are shown in the following table:
    Object
    Description
    Draws Terrain Dirty Areas (specific to Terrain layers).
    Draws TIN nodes to show node values.
    Draws TIN nodes.
    Draws TIN nodes to show elevation.
    Draws TIN edges.
    Draws TIN edges to show breaklines.
    Draws TIN faces.
    Draws TINs with their face value.
    TinElevationRenderer
    Draws TIN faces to show elevation.
    Draws TIN faces to show slope.
    Draws TIN faces to show aspect.
    • Accessing TIN renderers - A TinLayer keeps a collection of TIN renderers, and you can access them using ITinLayer. For TerrainLayers, use the ITerrainLayer interface. You can add multiple renderers, even of the same general type - node, edge, and face - to a TIN or Terrain layer's renderer collection. However, when two or more renderers of the same type are added, there can be a conflict, and it is the order in which you add your renderers that resolves this conflict.
    • TinRenderer abstract class - All TIN renderer classes conceptually inherit from an abstract class called TinRenderer. You can see this abstract class on the Renderers page of the Carto OMD. You can implement your own TIN renderer by implementing all the interfaces implemented by this class.

      TinRenderer implements ITinRenderer, which provides access to properties and methods common to all TIN renderers. This base class also implements persistence interfaces that allow TIN renderers to be saved and loaded from disk as part of .lyr and .mxd files. TIN renderers also implement ILegendInfo, which provides access to a renderer's legend information and symbols.

      Esri TIN renderers typically store the symbols they use to draw TIN data in LegendClass objects that can be accessed via ILegendInfo. However, when writing client code that works with a TIN renderer, it is best practice to access and change a renderer's symbols using the interface specific to the renderer you are using. For example, if working with TinNodeValueRenderer, use ITinUniqueValueRenderer, or if working with TinSlopeRenderer, use ITinColorRampRenderer.Symbol. Although ILegendInfo is also implemented by most layer classes, layers typically defer all methods and properties to the renderer's implementation.






    Development licensing Deployment licensing
    ArcGIS Desktop Basic ArcGIS Desktop Basic
    ArcGIS Desktop Standard ArcGIS Desktop Standard
    ArcGIS Desktop Advanced ArcGIS Desktop Advanced
    Engine Developer Kit Engine