[mapserver-dev] WMS GetStyles by CLASS GROUP

Seth G sethg at geographika.co.uk
Mon Mar 16 07:50:56 PDT 2020

Hi devs,

Currently, we can get SLD for a layer using &SERVICE=WMS&VERSION=1.3.0&REQUEST=GetStyles&LAYERS=mylayer as added in RFC 39 [1]. 

This returns all the styles available for a layer (in a NamedLayer tag). 
Each style is in a UserStyle tag (corresponding to the CLASS GROUP names) as described in the RFC:

"the current behavior is to return all the classes as UserStyle elements. the sld 1.0 specification does not seem to be clear on how to deal when multiple styles are available : section 13.1 specifies “…All requested styles that can in fact be described by SLD will be returned as UserStyle elements, and styles that cannot be will returned as NamedStyle elements. …”. The proposed approach is to keep the current behaviour if the CLASSGROUP is not set and if set, to return UserStyle elements on specified classes only."

It would be very useful for client applications to be able to return just the SLD for a specific style. 

Would the addition of a STYLES parameter similar to  WMS GetMap request to select a specific style be welcomed?
I can't find any reference to the GetStyles request in the WMS 1.3.0 spec, so is this a custom addition to the WMS protocol? It is also implemented in GeoServer [2], but undocumented.  

E.g. &SERVICE=WMS&VERSION=1.3.0&REQUEST=GetStyles&LAYERS=mylayer&STYLES=style1


[1] https://mapserver.org/development/rfc/ms-rfc-39.html
[2] http://osgeo-org.1560.x6.nabble.com/Does-GetStyles-work-in-Geoserver-2-12-td5335257.html

twitter: @geographika

More information about the mapserver-dev mailing list