Gets legend information, such as layer name, group heading, classification labels and symbol swatches, for layers in a map.
GetLegendInfo(string MapName, int[] LayerIDs, MapServerLegendPatch LegendPatch, ImageType ImageType)
Parameter |
Description |
MapName |
The name of the map (data frame) that will be used to generate legend info. |
LayerIDs |
An array of layer ids for which legend information will be returned. If empty or null, all layers will be included. |
LegendPatch |
Specifies the symbol swatch properties for legend classifications. If empty or null, the default patch properties defined in the map will be used. |
ImageType |
Defines the image type and method for returning the image content for the symbol swatches. Supported image types are bmp, jpg, tif, png/png8, png24, emf, ps, pdf, ai, gif, and svg/svgz. Image content can be returned as a URL or as a MIME data stream. |
Return Value
An array of MapServerLegendInfo objects, one for each layer specified in the method call. Group layers in a map service are not recognized.
Remarks
A map service does not have the ability to generate a single legend image with all legend content. Instead, this method provides access to legend content which can be used to construct a single consolidated legend.
Each MapServerLegendInfo object contains one or more MapServerLegendGroup objects, each containing one or more MapServerLegendClass objects.
The relationship between value objects and legend content is illustrated in the following diagram. Note that each MapServerLegendClass contains a classification label and symbol swatch.
Examples