I was wondering if there is a way in OL3 or Leaflet to load another SLD file other than the one is coupled with the layer in Geoserver. I have tried to find some topic related to this but no luck. That would be quite handy in cases you fetch data from a remote geoserver without permissions to style them. In that case you could apply your sld style (in url format) stored locally in your server. Are you aware if this is actually supported?
1 Answer
GeoServer supports SLD, SLD_BODY, and GET_STYLES with WMS version 1.1.1 if service administrator has not turned the feature off. It is less and less common to support remote styling with SLD because it has never been a great success and it also opens a way to send unfriendly SLD that at least makes heavy load for the WMS server.
You can test if server supports SLD by making a GetStyles request. If it is supported then probably also SDL and SLD_BODY are supported as well. That is not guaranteed, support for SLD requires that the remote server has connections open in the firewall so that it can read the SLD from the net.
The boundless demo server seems to send SLD with GetStyles
Save the SLD, edit for example the fill, save it on your http server and try if GetMap with &SLD=http://my_server.com/my_sld.sld
works as well.
-
thanks for the answer. Indeed having users creating the styles (e.g. using a webapp) could result to heavy slds. But that would be the only way to load remote wms services (which you dont' have access) and style them.– user1919Commented Apr 25, 2018 at 12:10