eblondel / ows4R

R Interface for OGC Web-Services (OWS)
https://eblondel.github.io/ows4R/
Other
36 stars 8 forks source link

Get all styles of a layer? #74

Closed itati01 closed 2 years ago

itati01 commented 2 years ago

Hi,

I just started to play with ows4r, so I hope that I do not miss anything obvious. The goal is to get all styles belonging to a layer. I currently can get just one style:

wms <- WMSClient$new(wms_url, "1.3.0")
lyr <- wms$getCapabilities()$findLayerByName(layer_name)
lyr$getStyle()

Would it be possible to extend getStyle to get more/all styles (or with a new getStyles method)? Thanks!

eblondel commented 2 years ago

@itati01 it's a mistake, the right method should be getStyles(). Just pushed a fix, if you want you can test reinstalling ows4R from github.

itati01 commented 2 years ago

@eblondel That was quick! Thanks a lot. By the way, is it possible to obtain attributes of the styles (e.g. title, long name)?

eblondel commented 2 years ago

yes i can extend it, and replace the current method by 'getStylenames', i do a commit soon...

eblondel commented 2 years ago

@itati01 here it goes. Now you have getStyles that returns a named list, and getStylenames.

itati01 commented 2 years ago

Thanks a lot. Both WMSLayer methods work. A small issue: the first two names returned by getStylenames() are (here) identical.

eblondel commented 2 years ago

If you can send me the WMS you are trying to query. I suppose that the default style is listed as additional available style for the same layer you are looking at, it means that the style is referenced more than once in the WMS GetCapabilities. I've tested it over various WMS and it works fine.

itati01 commented 2 years ago

I checked the Capabilities of the WMS server and found indeed two entries in the XML. So, the issue could be closed.