Skip to contents

Low-level interface to BKG-style web feature services (WFS). This function is used in all high-level functions of ffm that depend on a WFS, e.g., bkg_admin.

bkg_feature_types lists all available feature types for a given endpoint.

Usage

bkg_wfs(
  type_name,
  endpoint = type_name,
  version = "2.0.0",
  method = NULL,
  format = "application/json",
  layer = NULL,
  epsg = 3035,
  properties = NULL,
  filter = NULL,
  ...
)

bkg_feature_types(endpoint)

Arguments

type_name

Feature type of the WFS to retrieve. You can use bkg_feature_types to retrieve a list of feature type names for a given endpoint.

endpoint

Endpoint to interface. Note that wfs_ is appended and only the rest of the product name must be provided. For example, wfs_vg250 becomes vg250. Defaults to the value of type_name.

version

Service version of the WFS. Usually 2.0.0, but some services still use 1.0.0 or 1.1.0.

method

HTTP method to use for the request. GET requests provide parameters using URL queries. Filters must be provided as CQL queries. While this is less error-prone, it allows a maximum number of only 2048 characters. Especially when providing more sophisticated spatial queries, GET queries are simply not accepted by the services. In these cases it makes sense to use POST requests instead.

If NULL, the method is inferred from the type of filter query provided to filter (either XML or CQL). If no filter is provided, the method is inferred from getOption("ffm_query_language").

format

Content type of the output. This value heavily depends the endpoint queried. Most services allow application/json but some only support GML outputs. When in doubt, inspect the GetCapabilities of the target service. Defaults to "application/json".

layer

If format specifies a GML output, layer specifies which layer from the downloaded GML file to read. Only necessary if the GML file actually contains multiple layers. Defaults to NULL.

epsg

Numeric value giving the EPSG identifier of the coordinate reference system (CRS). The EPSG code is automatically formatted in a OGC-compliant manner. Note that not all EPSG codes are supported. Inspect the GetCapabilities of the target service to find out which EPSG codes are available. Defaults to EPSG:3035.

properties

Names of columns to include in the output. Defaults to NULL (all columns).

filter

A WFS filter query (CQL or XML) created by wfs_filter.

...

Further parameters passed to the WFS query. In case of POST requests, additional namespaces that may be necessary to query the WFS. Argument names are interpreted as the prefix (e.g. xmlns:wfs) and argument values as namespace links.

Value

An sf tibble

See also

bkg_wcs for a low-level WCS interface

wfs_filter for filter constructors

Examples

if (FALSE) { # getFromNamespace("ffm_run_examples", ns = "ffm")()
bkg_feature_types("vg5000_0101")

bkg_wfs(
  "vg5000_lan",
  endpoint = "vg5000_0101",
  count = 5,
  properties = "gen",
  epsg = 4326
)[-1]

# Filters are created using `wfs_filter()`
bkg_wfs(
  "vg5000_krs",
  endpoint = "vg5000_0101",
  properties = "gen",
  filter = wfs_filter(sn_l == 10)
)[-1]
}