Wednesday, June 19, 2013

ArcGIS server and additional WMS styles

Today I had the opportunity to do some experimenting with publishing WMS services on an ArcGIS server instance. My goal was to publish some alternative styles for a WMS layer (most wms clients offer possibility to change a style on a layer, if multiple styles are published in capabilities). Unfortunately it appeared to be quite a challenge to get this done...

As mentioned here, http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_Styled_Layer_Descriptors_with_WMS_services/015400000468000000/, Esri wants me to create an SLD file by hand (based on their snippets) and attach that to the service definition. Ok, quite experimental, but let's try

I used GeoCat bridge (http://geocat.net/bridge) to create the SLD from ArcMap. When I pointed to the SLD file created by bridge (on my local drive), no warning whatsoever, but no additional styles appeared in the WMS. It appears the file should either be located in the ArcGIS Server machine or accessible via the web (was it really strange for me to expect the file would be uploaded during publication?). So after having uploaded the SLD to a web account and inserting the url, the alternative style appeared, yeah!

The styles created by bridge need minor changes to get them working as extra styles in ArcGIS Server. For example the naming of layers is quite bizar in AGS. Layernames are actually increasing numbers (it must be quite a challenge to keep those numbers synchronised over time). So the named-layer section in the SLD should have something like

<sld:NamedLayer><sld:Name>1</sld:Name></sld:NamedLayer>

Also all styles for all layers in the service should be in a single SLD file, so the separate bridge SLD files should be concatenated to a single file.

Note that ArcGIS does not support the full set of SLD tags available in for example geoserver.
Test your style first before publishing to ArcGIS Server by adding the sld parameter to a single wms request.

http://AGS/Service/MapServer/WmsServer?LAYERS=0&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES=Velocity&FORMAT=image%2Fpng&SRS=EPSG%3A28992&BBOX=177900,314900,178000,315000&WIDTH=256&HEIGHT=256&sld=http://www/test.xml

During my small research I noticed following SLD tags/conventions not supported by AGS:
- <sld:rotation> on sld:mark is skipped
- having a ttf symbol as a wellknownname (convention within geoserver community), in stead use the well known names: circle, square, triangle, star, cross or x

No comments: