[OpenLayers-Users] Switch from one SLD to another

Fabian Patzke patzke at geoinformationsdienst.de
Wed Aug 12 11:31:19 EDT 2009



TJMartin wrote:
> 
> I have a shapefile loaded into GeoServer with 2 different SLDs to style
> the data differently depending a customer requirement.
> In OpenLayers i call the WMS with the various options (extents,projection
> etc)
> My map works but only with the SLD i attach to the data in geoserver. What
> i want is a button on the client side to switch to the second SLD.
> My openlayers code looks like this
> 
> [...]
> 
> and the two SLDs are 
> 
> simple.sld
> newstyle.sld
> 
You can merge a sld parameter to the layer with
layer.mergeNewParams({SLD: sldURL});
i.e.: layer.mergeNewParams({SLD: "http://localhost/SLD/simple.sld"});
sldURL should be the URL of your desired SLD. So the SLD must be reachable
for your geoserver via that URL.

Maybe this helps you a bit.

Greetings,
Fabian

-- 
View this message in context: http://n2.nabble.com/Switch-from-one-SLD-to-another-tp3424781p3431558.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list