Skip to contents

Performs an WFS getFeature request for layers from a wfs object or specified EMODnet Service. Filtering of layer features can also be handled via ECQL language filters.

Usage

emodnet_get_layers(
  wfs = NULL,
  service = NULL,
  service_version = NULL,
  layers,
  crs = NULL,
  cql_filter = NULL,
  reduce_layers = FALSE,
  ...
)

Arguments

wfs

A WFSClient R6 object with methods for interfacing an OGC Web Feature Service.

service

the EMODnet OGC WFS service name. For available services, see emodnet_wfs().

service_version

[Deprecated] the WFS service version. Now always "2.0.0".

layers

a character vector of layer names. To get info on layers, including layer_name use emodnet_get_wfs_info().

crs

integer. EPSG code for the output crs. If NULL (default), layers are returned with original crs.

cql_filter

character. Features returned can be filtered using valid Extended Common Query Language (ECQL) filtering statements (https://docs.geoserver.org/stable/en/user/filter/ecql_reference.html). Should be one of:

  • character string or character vector of length 1. Filter will be recycled across all layers requested

  • character vector of length equal to the length of layers. Filter will be matched to layers sequentially. Elements containing NA are ignored

  • named character vector. Each filter will be applied to the layer corresponding to the filter name. Filters with names that do not correspond to any layers are ignored. Layers without corresponding filters are returned whole

reduce_layers

whether to reduce output layers to a single sf object.

...

additional vendor parameter arguments passed to ows4R::GetFeature().# nolint For example, including count=1 returns the first available feature.

Value

If reduce_layers = FALSE (default), a list of sf

objects, one element for each layer. Any layers for which download was unsuccessful will be NULL. If reduce_layers = TRUE, all layers are reduced (if possible) to a single sf containing data for all layers. NULL layers are ignored. reduce_layers = TRUE can also be used to return an sf out of a single layer request instead of a list of length 1.

Examples

if (FALSE) {
# Layers as character vector
emodnet_get_layers(
  service = "seabed_habitats_individual_habitat_map_and_model_datasets",
  layers = c("dk003069", "dk003070")
)

# Layers as character vector, layers to be reduced
emodnet_get_layers(
  service = "seabed_habitats_individual_habitat_map_and_model_datasets",
  layers = c("dk003069", "dk003070"),
  reduce_layers = TRUE
)

# Usage of cql_filter
emodnet_get_layers(
  service = "human_activities",
  layers = "maritimebnds",
  cql_filter = "sitename='Territory sea (12 nm)'",
  reduce_layers = TRUE
)
# Usage of vendor parameter
emodnet_get_layers(
  service = "human_activities",
  layers = "maritimebnds",
  count = 1,
  reduce_layers = TRUE
)
}