2.6.1 Layer styling information
The examples below show the styling portion of the GetCapabilities response. The first two come from MapServer services, and show that the legend will be generated on-the-fly using an SLD GetLegendGraphic request. The third example shows a simple request to a static image, generated in advance by the map service provider.
Example style information from a MapServer version 4.10.3 WMS version 1.1.1. GetCapabilities response. The legend will be created automatically by MapServer and served using an SLD GetLegendGraphic operation.
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL width=“20” height=“10”>
<Format>image/png</Format>
<OnlineResource
xmlns:xlink=“http://www.w3.org/1999/xlink”
xlink:type=“simple”
xlink:href=“http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms?
version=1.1.1&
service=WMS&
request=GetLegendGraphic&
layer=UKCoShelf_BGS_1M_SBS&
format=image/png&” />
</LegendURL>
</Style>
Example style information from a MapServer version 5.6.5 WMS version 1.3.0. GetCapabilities response. The legend will be created automatically by MapServer and served using an SLD GetLegendGraphic operation. Note the OnlineResource URL now includes an sld_version parameter.
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL width=“328” height=“3013”>
<Format>image/png</Format>
<OnlineResource
xmlns:xlink=“http://www.w3.org/1999/xlink”
xlink:type=“simple”
xlink:href=“http://ogc.bgs.ac.uk/cgi-bin/BGS_GSN_Bedrock_Geology/wms?
version=1.3.0&
service=WMS&
request=GetLegendGraphic&
sld_version=1.1.0&
layer=NAM_GSN_1M_BLS&
format=image/png&
STYLE=default&”/>
</LegendURL>
</Style>
Example style information from an ArcGIS server WMS version 1.3.0. GetCapabilities response. A detailed static legend is provided.
<Style>
<Name>default</Name>
<Title>US-KY KGS 1:500K Kentucky Geologic Formations</Title>
<LegendURL width=“100” height=“588”>
<Format>image/png</Format>
<OnlineResource
xlink:href=“http://.../.../KGS_Geology_and_Faults_MapServer/wms/default2.png&”
xlink:type=“simple”
xmlns:xlink=“http://www.w3.org/1999/xlink” />
</LegendURL>
</Style>
Section last modified: 07 October 2015