Skip to contents

WMSClient

WMSClient

Format

R6Class object.

Value

Object of R6Class with methods for interfacing an OGC Web Map Service.

Author

Emmanuel Blondel <emmanuel.blondel1@gmail.com>

Super classes

ows4R::OGCAbstractObject -> ows4R::OWSClient -> WMSClient

Methods

Inherited methods


Method 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

Usage

WMSClient$new(
  url,
  serviceVersion = NULL,
  user = NULL,
  pwd = NULL,
  token = NULL,
  headers = c(),
  config = httr::config(),
  cas_url = NULL,
  logger = NULL
)

Arguments

url

url

serviceVersion

WFS service version

user

user

pwd

password

token

token

headers

headers

config

config

cas_url

Central Authentication Service (CAS) URL

logger

logger


Method getCapabilities()

Get WMS capabilities

Usage

WMSClient$getCapabilities()

Returns

an object of class WMSCapabilities


Method reloadCapabilities()

Reloads WFS capabilities

Usage

WMSClient$reloadCapabilities()


Method getLayers()

List the layers available. If pretty is TRUE, the output will be an object of class data.frame

Usage

WMSClient$getLayers(pretty = FALSE)

Arguments

pretty

pretty

Returns

a list of WMSLayer available, or a data.frame


Method getMap()

Get map. NOT YET IMPLEMENTED

Usage

WMSClient$getMap()


Method getFeatureInfo()

Get feature info

Usage

WMSClient$getFeatureInfo(
  layer,
  srs = NULL,
  styles = NULL,
  feature_count = 1,
  x,
  y,
  width,
  height,
  bbox,
  info_format = "application/vnd.ogc.gml",
  ...
)

Arguments

layer

layer name

srs

srs

styles

styles

feature_count

feature count. Default is 1

x

x

y

y

width

width

height

height

bbox

bbox

info_format

info format. Default is "application/vnd.ogc.gml"

...

any other parameter to pass to a WMSGetFeatureInfo request

Returns

an object of class sf given the feature(s)


Method getLegendGraphic()

Get legend graphic. NOT YET IMPLEMENTED

Usage

WMSClient$getLegendGraphic()


Method clone()

The objects of this class are cloneable with this method.

Usage

WMSClient$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# \dontrun{
   #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")
#> Error in curl::curl_fetch_memory(url, handle = handle): Failed to connect to localhost port 8080 after 0 ms: Connection refused
   
   #get capabilities
   caps <- wms$getCapabilities()
#> Error in eval(expr, envir, enclos): object 'wms' not found
   
   #get feature info
   
   #Advanced examples at https://github.com/eblondel/ows4R/wiki#wms
# }