[mapserver-dev] WMS GetStyles by CLASS GROUP

Seth G sethg at geographika.co.uk
Mon Mar 16 10:36:52 PDT 2020

Thanks for that info Jukka. 

So the GetStyles part of the WMS spec was simply to define a new keyword for the REQUEST operation, without any further details?

It is supported in MapServer for both WMS 1.1.1 (returning SLD 1.0.0) and WMS 1.3.0 (returning SLD 1.1.0). 

Would you be for or against allowing a STYLES parameter to be added to a GetStyles request to limit the UserStyle returned in a SLD?

I hadn't considered trying to list available UserStyles in a DescribeLayer request. 

My use-case is an OpenLayers client, that can read a MapServer WFS service and apply SLD via the MapServer WMS service for the same layer. When there are multiple UserStyles returned this currently fails, and would require some client-side parsing to get a single style. Having this available in MapServer would be a better solution in my view. 



twitter: @geographika

On Mon, Mar 16, 2020, at 6:07 PM, Rahkonen Jukka (MML) wrote:
> Hi,
> WMS 1.3.0 standard kinda removed the support for SLD-styles
> "A basic WMS classifies its geographic information holdings into 
> “Layers” and offers a finite number of predefined “Styles” in which to 
> display those layers. This International
> Standard supports only named Layers and Styles, and does not include a 
> mechanism for user-defined symbolization of feature data."
> WMS 1.1.1 told a bit more about SLD support
> "For the use of the Styled Layer Descriptor specification, three new optional
> operations are named, but not otherwise specified, in this document
> (GetLegendGraphic, GetStyles, PutStyles)."
> But even WMS 1.3.0 does not really mention that SLD stuff is supported, 
> the SLD standard 
> http://portal.opengeospatial.org/files/?artifact_id=22364 is bringing 
> the SLD profile into WMS 1.3.0.
> "GetMap is defined in WMS 1.3. The SLD profile for WMS defines 
> additional parameters
> allowing clients to request layers to be portrayed according to some 
> specified style. The
> basic WMS specification defines HTTP GET (mandatory) and HTTP POST 
> (optional)
> for invoking operations."
> You should read WMS and SLD standards as pairs with matching versions.
> WMS+SLD combination is rather cryptic and somehow half-way ready, as 
> well as the implementations in Mapserver, Geoserver, and others. I am 
> not sure if it is even possible to make them 100% standard compliant. 
> However, users can do useful things with GET_STYLES and &SLD/&SDL_BODY 
> and I think that it is good to support them and  admins can adjust the 
> "ows_sld_enabled" option.
> For example I doubt I have ever seen a Mapserver that sends reasonable 
> response to DescribeLayer and probably no client is trying to use it 
> for resolving the schema of the layer.
> -Jukka Rahkonen-
> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-dev <mapserver-dev-bounces at lists.osgeo.org> Puolesta Seth G
> Lähetetty: maanantai 16. maaliskuuta 2020 16.51
> Vastaanottaja: mapserver-dev at lists.osgeo.org
> Aihe: [mapserver-dev] WMS GetStyles by CLASS GROUP
> 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
> Seth
> [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
> --
> web:http://geographika.co.uk
> twitter: @geographika
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev

More information about the mapserver-dev mailing list