Using Styled Layer Descriptors (SLDs) with WMS services

Release 9.3.1 E-mail This Topic Printable Version Give Us Feedback

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:

  1. Create a WMS service with system-generated capabilities files.
  2. Create a single SLD XML document that defines multiple styles for each layer in the WMS service.
  3. Bind the SLD XML with the WMS service.

To accomplish this, follow these steps in ArcCatalog or ArcGIS Server Manager:

  1. Start ArcCatalog or log in to ArcGIS Server Manager.
  2. Publish a WMS service, using the instructions in WMS services.
  3. 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.
  4. Stop the map service if it's still running.
  5. 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.
  6. Click the Capabilities tab.
  7. In the capabilities list, check WMS if it's not checked yet.
  8. 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.
  9. Restart the map service.
  10. 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:

  1. 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.
  2. 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).
  3. 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.
  4. 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.

Samples

For working samples of SLDs, see the SLD samples topic.