[mapserver-users] Changing WMS Styles on the FLy

Bill Thoen bthoen at gisnet.com
Sat Oct 17 14:03:01 EDT 2009


Guillaume Sueur wrote:
> What you can do is build a default SLD file (generated from your mapfile
> settings, mapscript has got functions for that), allow its edition on
> the client side (modification of fill and stroke colors for instance),
> and save it back to a temp (or not) location, with a specific name. Then
> send getMap again with SLD parameter pointing to that new SLD file. Note
> that the sld file must be accessible for mapserver with http.
>   
Thanks for the quick response, Guillaume. I'm aware of mapscript's 
ability to automatically generate SLD file for existing layers, but I've 
got to fix my version of mapscript before I can try that. Your point 
about access permissions is well-taken though; I had forgotten that 
subtle, but critical, fact.

As it turned out, my problem was more fundamental. In the SLD 
documentation (http://www.mapserver.org/ogc/sld.html) the example GetMap 
Request leaves out several required parameters, which also generates an 
unhelpful "Something went wrong" error message. I finally realized that 
a GetMap request requires BBOX, SRS, WIDTH,... etc. parameters, and that 
I hadn't specified them. Once I fixed that dumb mistake, it worked just 
fine.  Moral is, don't believe everything you read.

One question I still have though... GetMap returns an image, but I don't 
know how to get it in my map window yet. I can adjust the 1:1 aspect 
ratio to match my BBOX and map window aspect ratio, but how do I update 
a particular layer with SLD and keep it in my map?

-- 
- Bill Thoen 
  GISnet - www.gisnet.com
  303-786-9961



More information about the mapserver-users mailing list