I am working with MapServer WMS in the form of mapfiles and consuming them into a OpenLayers map.
I am trying to find out a way to ease the symbolization process of the various layers in a mapfile.
I have not started diving into the STYLE directive yet, but before I do that I'd like to know whether there's an easy way to (let's say) preview the style of my layers (an application?) and export it into a (e.g.) SLD which the MapServer can read.
I don't know if this is the best (or feasible) way to go about styling mapfile's layers, but I am open to any kind of suggestion.
Best Answer
You can't use SLD to internally style a MapServer WMS map, you'll have to use the
STYLE
directives.However
MapServer will take an SLD as part of a GetMap request, either by reference (you link to a URL of the SLD), using the
SLD=[your link to your SLD]&
parameter or directly as part of theSLD_BODY=[your SLD]&
parameter.You can review this in a browser.
Exercise
Consider a MapServer WMS providing radon information.
A GetMap request using the default style might look like:
Giving a map like:
The map file definition of the style is:
But a general user can't see this. A user though can make a GetStyles request like:
Which is MapServers effort at converting the internal style to SLD, so here it gives us:
We could take this style, modify it, put it on a server, and request it as part of a GetMap request like:
Giving us: