# GeoExt

### Navigation

- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.WMSLegend`

# `GeoExt.WMSLegend`

Extends
  - Ext.Container
  - `GeoExt.LayerLegend`
xtype
  `gx_wmslegend`

class `GeoExt.``WMSLegend`(config)

Show a legend image for a WMS layer. The image can be read from the styles field of a layer record (if the record comes e.g. from a `GeoExt.data.WMSCapabilitiesReader`). If not provided, a GetLegendGraphic request will be issued to retrieve the image.

## Config Options

Configuration properties in addition to those listed for Ext.Container.

`baseParams`
  `Object`

    Optional parameters to add to the legend url, this can e.g. be used to support vendor-specific parameters in a SLD WMS GetLegendGraphic request. To override the default MIME type of image/gif use the FORMAT parameter in baseParams.

        var legendPanel = new GeoExt.LegendPanel({
            map: map,
            title: 'Legend Panel',
            defaults: {
                style: 'padding:5px',
                baseParams: {
                    FORMAT: 'image/png',
                    LEGEND_OPTIONS: 'forceLabels:on'
                }
            }
        });

`defaultStyleIsFirst`
  `Boolean` The WMS spec does not say if the first style advertised for a layer in a Capabilities document is the default style that the layer is rendered with. We make this assumption by default. To be strictly WMS compliant, set this to false, but make sure to configure a STYLES param with your WMS layers, otherwise LegendURLs advertised in the GetCapabilities document cannot be used.

`labelCls`
  `String` Optional css class to use for the layer title labels.

`layerRecord`
  `GeoExt.data.LayerRecord` The layer record for the legend

`legendTitle`
  `String` Optional title to be displayed instead of the layer title. If this is set, the value of `showTitle` will be ignored (assumed to be true).

`showTitle`
  `Boolean` Whether or not to show the title of a layer. This can be overridden on the LayerStore record using the hideTitle property.

`useScaleParameter`
  `Boolean` Should we use the optional SCALE parameter in the SLD WMS GetLegendGraphic request? Defaults to true.

### Navigation

- index
- modules |
- next |
- previous |
- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.WMSLegend`