OpenLayers 3 – How to Add SLD to a WMS Layer

openlayerssldwms

I wonder if I can add SLD style to WMS or WFS layer existing in GeoServer, using OpenLayers 3?

Best Answer

Well it is certainly possible to construct an SLD and send it directly or by reference as part of a WMS GetMap request to a GeoServer service, with OpenLayers as a client. This is something done by the OneGeology portal as part of their thematic analysis tools.

It isn't possible for WFS, because a WFS doesn't deal in styling, you just get the raw data from the server and have to render it in your client.