[mapserver-users] SLD with Mapserver 5.4.2
Andrea Dessì
nkjoep at gmail.com
Fri Jul 31 08:16:42 PDT 2009
Michael Schulz ha scritto:
> Hi Andrea,
>
> mapserver uses sld in "library" mode, meaning that if for a certain
> layer of the mapfile an sld symbolization is provided it takes
> precedence over the mapfile symbolization. If for another layer no sld
> id provided, then the mapfile symbolization is used. Thus, As far as I
> know you can only "replace" the symbolization of a complete layer and
> not add styling in a sense of taking the labelling definitions from
> the mapfile and the fill-color from the sld for one layer.
>
Yes, it's working now ;)
> It may nevertheless be that some definitions regarding symbolization
> are mixed, e.g. the transparency settings of a layer is kept when
> applying an sld (at least this was the case for older versions).
>
> When you really want to add something to the symbolization, a possible
> approach would be to use the getstyle request to obtain mapserver's
> sld-representation of the current layer styling, then you could add or
> modify that and sent it back modified for a getmap request.
>
Michael, using java, we get the layer's style from the request.
Before doing the new request to WMS server, we tried to extract the
old style and then add a new style (in the new request there are the
old and the new ones)
So using geotools we have:
[...]
StyleImpl styleImpl = new StyleImpl(); // istantiate new Style
List<FeatureTypeStyle> featuresStyles = new
ArrayList<FeatureTypeStyle>(); //define list of styles
featuresStyles.add(featureTypeStyle); // defining style list
styleImpl.setFeatureStyles(featuresStyles); // applying feature
styles to the current style
List<StyleImpl> st = new ArrayList<StyleImpl>(); // the new style list
st.add(style); // adding the old style coming from the request
st.add(styleImpl); // adding our new style
// then defining the new request with layer...
Layer l = new Layer();
l.setStyles(st);
l.setName("nycroads");
request.addLayer(l);
[...]
So we are trying to:
- ask getCapabilites to WMS server
- retrieving the style list from the layer
- retrieve the old style from the layer
- create a new style for the layer
- insert one old style and a new one to the layer
- do a request with the elaborated layer
result: not working :)
is it a good approach?
Thank you,
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090731/de485803/attachment.htm>
More information about the MapServer-users
mailing list