Styled Layer Descriptors (SLDs) allow you to publish various symbolization schemes for your WMS service using an XML specification defined by the Open Geospatial Consortium (OGC). Alternatively, clients of your service can use their own SLDs to apply the symbols they choose.
SLD files and SLD styles
An SLD file is an XML file that follows the OGC SLD syntax
so that it can be understood in server-client communication.
SLD styles are physically saved in the SLD file. Logically, one such SLD style defines symbolization rules for specified sets of features within a specified WMS layer. One style can have multiple rules and each rule can have one filter which describes which features should be rendered, and multiple symbolizers which describe how those features should be rendered.
Here is a sample SLD xml document:
The implementation of WMS SLD in ArcGIS Server 9.3 is based on the Styled Layer Descriptor Implementation Specification. To get a general overview of SLD, see the Styled Layer Descriptor page on the OGC Web site.
Publishing multiple styles with SLD
You can use the following workflow to publish multiple styles for WMS layers using SLD:
- Create a WMS service with system-generated capabilities files.
- Create a single SLD XML document that defines multiple styles for each layer in the WMS service.
- Bind the SLD XML with the WMS service.
To accomplish this, follow these steps in ArcCatalog or ArcGIS Server Manager:
- Start ArcCatalog or log in to ArcGIS Server Manager.
- Publish a WMS service, using the instructions in WMS services.
- Create an XML document in SLD syntax that defines additional styles for each WMS layer you want to publish. You can save this SLD XML document to the local disk or make it accessible as a URL.
- Stop the map service if it's still running.
- Open the map service properties dialog box. To do this in ArcCatalog, right-click an existing map service and click Service Properties. In ArcGIS Server Manager, click the Edit icon of an existing map service on the Services tab.
- Click the Capabilities tab.
- In the capabilities list, check WMS if it's not checked yet.
- Below the Properties section of the Capabilities tab you will see the "SLD URL or Path" text box. Type the URL of your SLD XML or use the File Browser to locate your SLD XML on your local disk.
- Restart the map service.
To make sure the SLD XML is correctly bound with the WMS service, do one of the following:
- Issue a WMS GetCapabilities request in the browser. In the XML response, there should be one <Style> element being advertised for each additional style you defined in the SLD for each WMS layer.
- Examine the folder <map_service_output_directory>\<service_name_MapServer>\wms\. There should be one legend image file being generated for each additional style you defined in the SLD for each WMS layer.
Changing the style of a WMS map in ArcGIS Desktop
Once you bind an SLD XML file to an ArcGIS Server WMS service, for each layer applicable styles will be picked up and advertised through that WMS service's capabilities information. Certain WMS client like ArcMap will then be aware of those styles and will allow you switch between those styles.
To learn how to switch to use a different style of a WMS layer, please see Properties of WMS service sublayers in the ArcGIS Desktop help.
Note: Many other WMS clients like Gaia and uDig have the feature to allow user to use different styles for a WMS layer as long as those styles are listed in WMS service's capabilities information.
Using external SLDs from the client side
With ArcGIS Server WMS services, users are not limited to the styles published on the server. Clients can reference an applicable SLD file in the WMS GetMap request so that the WMS service renders the map using their own styles.
Using an external SLD from the client side involves the following steps:
- Create a single SLD XML document that defines multiple styles for each layer in the WMS service, or you can even use a public SLD xml if it's applicable to your WMS service.
- Make the SLD XML accessible as a URL which must be accessible to the server (if you use a public SLD XML, make sure it's accessible as a URL).
- Change the values of the LAYERS and STYLES parameters in the original WMS HTTP GetMap request to indicate which style the WMS server should use to render each layer.
- Send the SLD XML to the WMS server and request the map by adding one more key-value parameter pair (SLD=<sld_xml_url>) to the end of a WMS HTTP GetMap request string.
For working samples of SLDs, see the SLD samples topic.