IMapServerLegendInfo Interface

Provides access to the Map Server Legend Info Interface.

When To Use

Use IMapServerLegendInfo to retrieve individual legend elements including the symbol image, labels, descriptions and headings. A common use would be to populate a table of contents. To export a single image of the legend use ExportLegend on IMapServerLayout.

Members

Name Description
Read-only property LayerID The layer ID.
Read-only property LayerName The layer name.
Read-only property LegendGroups A collection of legend group objects.

IMapServerLegendInfo.LayerID Property

The layer ID.

Public ReadOnly Property LayerID As Integer
public int LayerID {get;}

IMapServerLegendInfo.LayerName Property

The layer name.

Public ReadOnly Property LayerName As String
public string LayerName {get;}

IMapServerLegendInfo.LegendGroups Property

A collection of legend group objects.

Public ReadOnly Property LegendGroups As IMapServerLegendGroups
public IMapServerLegendGroups LegendGroups {get;}

Remarks

Legends are associated with renderers that belong to each layer in a map. Each layer has a separate renderer. Each renderer has one or more legend groups. Each legend group has one or more legend classes.

Classes that implement IMapServerLegendInfo

Classes Description
MapServerLegendInfo The Map Server Legend Info coclass provides legend information for a layer.

Remarks

MapServerLegendInfo objects are the result of a GetLegendInfo method on IMapServer. Legends are associated with renderers that belong to each layer in a map. Each layer has a separate renderer. Each renderer has one or more legend groups. Each legend group has one or more legend classes.

MapServerLegendInfo doesn't contain information about whether the data frame and the layers in the TOC are expanded or collapsed in the original map document. You have to write your own code to find this out.

The following sample code shows how to determine whether the data frame and the layers in the TOC are expanded or collapsed in the original map document. The sample assumes that you already have a valid MapServer object.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.