0

I have a layer in geoserver with an SLD style, which I display in a map web app using OpenLayers2. I want to know if there is a way to change part of the style (the width of the line geometry) through Openlayers? Is it possible to manipulate easily the SLD (style) of the WMS?

1

The quick answer to the question is yes it is possible.

You will need to construct an external SLD file, and store it on your server, then you will need to send a GetMap request that references that SLD in your request.

So here for example is a GetMap request to a GeoServer WMS (generated through a web client using OpenLayers)

GetMap to a GeoServer WMS

GeoServer WMS layer with default style

And here is a request to the same GeoServer WMS layer, but this time using an external SLD file, generated through the same OL client, (well sort of... I hacked it a bit after its creation to add the red stroke, because the client in question only permits changing polygon fill).

GetMap to a GeoServer WMS with external SLD

GeoServer WMS layer with external style

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.