Fetches vector features from a WFS, OGC API Features, or ArcGIS REST endpoint and returns a tibble with a wk::wkb geometry column.

wfs_read(
  base_url,
  layer,
  bbox = NULL,
  max_features = 100,
  where = NULL,
  driver = "auto",
  version = NULL,
  srs = NULL,
  convert_linear = TRUE,
  promote_to_multi = FALSE
)

Arguments

base_url

Character. The service endpoint URL.

layer

Character. Layer name to read. Use wfs_layers() to discover available layers.

bbox

Numeric vector of length 4 (xmin, ymin, xmax, ymax) or NULL for no spatial filter. Coordinates should be in the SRS specified by srs (or the layer's native SRS if srs is NULL).

max_features

Integer or NULL. Maximum number of features to request. For WFS, passed as count in the URL. For other drivers, features are truncated after fetch.

where

Character or NULL. An OGR SQL WHERE clause to filter features by attribute.

driver

Character. Driver hint; see wfs_connection().

version

Character or NULL. WFS version (e.g. "2.0.0").

srs

Character or NULL. Target SRS as "EPSG:XXXX".

convert_linear

Logical. If TRUE (default), convert circular arc geometries to linear approximations.

promote_to_multi

Logical. If TRUE, promote single-part geometries to multi-part. Default FALSE.

Value

A tibble::tibble with attribute columns and a geometry column of class wk::wkb.

Examples

if (FALSE) { # \dontrun{
# Tasmania LIST: cadastral parcels in Sandy Bay
parcels <- wfs_read(
  wfs_example_url("list_tasmania"),
  layer = "Public_OpenDataWFS:LIST_Cadastral_Parcels",
  bbox = wfs_example_bbox("sandy_bay"),
  srs = "EPSG:28355",
  max_features = 100
)
parcels
wk::wk_plot(parcels$geometry)

# Esri sample world cities
cities <- wfs_read(
  wfs_example_url("esri_sample"),
  layer = "esri:cities"
)
} # }