This function constructs a URL
request from its arguments and either reads
in the resulting vector layer as a sf
object or returns the number of
features that are requested.
The request is made up of key-value pairs and additional key-value pairs can
be passed to the function.
The full documentation for the WFS
standard can be consulted from
https://www.ogc.org/standard/wfs/.
get_feature_wfs(
wfs,
version = "2.0.0",
layername = NULL,
crs = NULL,
bbox = NULL,
filter = NULL,
cql_filter = NULL,
output_format = NULL,
property_name = NULL,
result_type = c("results", "hits"),
...
)
Web address for the service which you want to query features from
Version number for the service.
For instance "2.0.0"
.
Optional name of a layer hosted by the web feature service
Optional coordinate reference system to represent the features.
For instance "EPSG:31370"
.
Optional bounding box.
Pass this as a named vector with names "xmin"
, "xmax"
, "ymin"
,
"ymax"
.
Optional standard OGC filter specification
Optional
Contextual Query Language filter.
This currently only works if the WFS
is hosted on a GeoServer
.
Optional output format supported by the WFS
.
Optional character string.
Which fields or columns to return?
If you want to specify multiple columns, separate them by a comma.
The column containing the feature geometry is usually called geom
,
geometry
or SHAPE
.
For version "2.x.x"
, this can be either "results"
(default) or "hits"
.
The former returns the requested features, the latter returns the number of
requested features.
Additional key-value pairs passed on to the WFS query.
See https://inbo.github.io/tutorials/tutorials/spatial_wfs_services/ for more information.
Other topics on using web services:
add_wms_be_cartoweb()
,
add_wmts_nl_brt()
,
get_coverage_wcs()
if (FALSE) {
vlaanderen <- get_feature_wfs(
wfs = paste0(
"https://eservices.minfin.fgov.be/",
"arcgis/services/R2C/Regions/MapServer/WFSServer"
),
layername = "regions",
crs = "EPSG:31370",
filter = paste0(
"<Filter><PropertyIsEqualTo><PropertyName>",
"regions:NameDUT</PropertyName><Literal>'Vlaams Gewest'",
"</Literal></PropertyIsEqualTo></Filter>"
)
)
}