WMSClient
WMSClient
Object of R6Class with methods for interfacing an OGC
Web Map Service.
R6Class object.
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
ows4R::OGCAbstractObject -> ows4R::OWSClient -> WMSClient
Inherited methods
ows4R::OGCAbstractObject$ERROR()ows4R::OGCAbstractObject$INFO()ows4R::OGCAbstractObject$WARN()ows4R::OGCAbstractObject$encode()ows4R::OGCAbstractObject$getClass()ows4R::OGCAbstractObject$getClassName()ows4R::OGCAbstractObject$getNamespaceDefinition()ows4R::OGCAbstractObject$isFieldInheritedFrom()ows4R::OGCAbstractObject$logger()ows4R::OWSClient$getCASUrl()ows4R::OWSClient$getConfig()ows4R::OWSClient$getHeaders()ows4R::OWSClient$getPwd()ows4R::OWSClient$getToken()ows4R::OWSClient$getUrl()ows4R::OWSClient$getUser()ows4R::OWSClient$getVersion()
new()This method is used to instantiate a WMSClient with the url of the
OGC service. Authentication is supported using basic auth (using user/pwd arguments),
bearer token (using token argument), or custom (using headers argument). By default, the logger
argument will be set to NULL (no logger). This argument accepts two possible
values: INFO: to print only ows4R logs, DEBUG: to print more verbose logs
WMSClient$new(
url,
serviceVersion = NULL,
user = NULL,
pwd = NULL,
token = NULL,
headers = c(),
config = httr::config(),
cas_url = NULL,
logger = NULL
)urlurl
serviceVersionWFS service version
useruser
pwdpassword
tokentoken
headersheaders
configconfig
cas_urlCentral Authentication Service (CAS) URL
loggerlogger
getCapabilities()Get WMS capabilities
WMSClient$getCapabilities()an object of class WMSCapabilities
reloadCapabilities()Reloads WFS capabilities
WMSClient$reloadCapabilities()
getLayers()List the layers available. If pretty is TRUE,
the output will be an object of class data.frame
WMSClient$getLayers(pretty = FALSE)prettypretty
a list of WMSLayer available, or a data.frame
getMap()Get map. NOT YET IMPLEMENTED
WMSClient$getMap()
getFeatureInfo()Get feature info
WMSClient$getFeatureInfo(
layer,
srs = NULL,
styles = NULL,
feature_count = 1,
x,
y,
width,
height,
bbox,
info_format = "application/vnd.ogc.gml",
...
)layerlayer name
srssrs
stylesstyles
feature_countfeature count. Default is 1
xx
yy
widthwidth
heightheight
bboxbbox
info_formatinfo format. Default is "application/vnd.ogc.gml"
...any other parameter to pass to a WMSGetFeatureInfo request
an object of class sf given the feature(s)
getLegendGraphic()Get legend graphic. NOT YET IMPLEMENTED
WMSClient$getLegendGraphic()
clone()The objects of this class are cloneable with this method.
WMSClient$clone(deep = FALSE)deepWhether to make a deep clone.
# \donttest{
#example based on a WMS endpoint responding at http://localhost:8080/geoserver/wms
wms <- WMSClient$new("http://localhost:8080/geoserver/wms", serviceVersion = "1.1.1")
#get capabilities
caps <- wms$getCapabilities()
#get feature info
#Advanced examples at https://github.com/eblondel/ows4R/wiki#wms
# }
Run the code above in your browser using DataLab