Add a Legend to Your Map

Unlike other map components such as themes and styles, legends cannot be included as part of the static definition of a named map. That is, the named resource schemas do not provide any elements for including a legend in a named map's definition file. Instead, legends are always generated 'on-the-fly' when the named map is requested, based on the defined themes and styles of the map's layers.

A map legend is composed of individual legend entries or rows. Each legend entry in turn is composed of a symbol or color swatch followed by a text description. When you submit a request for the legend of a named map, zero, one, or more legend entries are returned for each layer in the named map. For TAB files (native and NativeX), a legend can also be returned for a unique set of text styles in a text layer.

When you want to request a legend for a map, the request must be submitted to the Mapping Service. You can submit the Mapping Service request directly through either the SOAP interface or the REST interface, or indirectly through the JavaScript API components.