| Title: | Download Official Spatial Data from Germany |
|---|---|
| Description: | Provides quick and easy access to official spatial data from Germany’s Federal Agency for Cartography and Geodesy (BKG) <https://gdz.bkg.bund.de/>. Interfaces various web feature services (WFS) and download servers. Allows retrieval, caching and filtering with a wide range of open geodata products, including administrative or non-administrative boundaries, land cover, elevation models, geographic names, and points of interest covering Germany. Can be particularly useful for linking regional statistics to their spatial representations and streamlining workflows that involve spatial data of Germany. |
| Authors: | Jonas Lieth [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-3451-3176>) |
| Maintainer: | Jonas Lieth <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-06-01 07:05:14 UTC |
| Source: | https://github.com/jslth/ffm |
Three sf dataframes containing all geometries of
German districts, federal states, and the country, respectively. The
reference year is 2023.
bkg_krs bkg_states bkg_germanybkg_krs bkg_states bkg_germany
For the dataframe format, see bkg_admin.
An object of class sf (inherits from tbl_df, tbl, data.frame) with 25 rows and 25 columns.
An object of class sf (inherits from tbl_df, tbl, data.frame) with 7 rows and 25 columns.
© BKG (2025) dl-de/by-2-0, data sources: https://sgx.geodatenzentrum.de/web_public/gdz/datenquellen/Datenquellen_vg_nuts.pdf
Other datasets:
nuts_data
bkg_krsbkg_krs
Retrieve polygon geometries of administrative areas in Germany. All administrative levels are supported at different spatial resolutions.
bkg_admin interfaces a WFS that allows prefiltering but
provides no historical data and allows a maximum scale of 1:250,000.
bkg_admin_archive allows access to historical data but
has no prefiltering.
bkg_admin_highres (vg25) allows access to
high-resolution data going as low as 1:25,000 but allows no prefiltering.
These functions interface the vg* products of the BKG.
bkg_admin( ..., level = "krs", scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL ) bkg_admin_archive( level = "krs", scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_admin_highres( level = "krs", year = "latest", layer = NULL, timeout = 600, update_cache = FALSE )bkg_admin( ..., level = "krs", scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL ) bkg_admin_archive( level = "krs", scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_admin_highres( level = "krs", year = "latest", layer = NULL, timeout = 600, update_cache = FALSE )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
level |
Administrative level to download. Must be one of
|
||||||||||||||||||||||||||||||
scale |
Scale of the geometries. Can be |
||||||||||||||||||||||||||||||
key_date |
For |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
||||||||||||||||||||||||||||||
year |
Version year of the dataset. You can use |
||||||||||||||||||||||||||||||
timeout |
Timeout value for the data download passed to
|
||||||||||||||||||||||||||||||
update_cache |
By default, downloaded files are cached in the
|
||||||||||||||||||||||||||||||
layer |
The |
An sf dataframe with multipolygon geometries and different columns depending on the geometry type. Areal geometries generally have the following columns:
objid: Unique object identifier
beginn: Creation of the object in the DLM
ade: Integer representing the administrative level. Can
be one of
1: Germany
2: Federal state
3: Governmental district
4: District
5: Administrative association
6: Municipality
gf: Integer representing the geofactor; whether an area is
"structured" or not. Land is structured if it is part of a state or other
administrative unit but is not further divided into administrative units.
Can be one of
1: Unstructured, waterbody
2: Structured, waterbody
3: Unstructured, land
4: Structured, land
bsg: Special areas, can be 1 (Germany) or 9 (Lake Constance)
ars: Territorial code (Amtlicher Regionalschlüssel).
The ARS is stuctured hierarchically as follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-9: Administrative association
Position 10-12: Municipality
ags: Official municipality key (Amtlicher Gemeindeschlüssel).
Related to the ARS but shortened to omit position 6 to 9. Structured as
follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-8: Municipality
sdv_ars: ARS of the seat of administration
gen: Geographical name
bez: Label of the administrative unit
ibz: Identifier of the label
bem: Comment on the label
nbd: Formation of the geographical name. Can be "ja" if
the label is part of the name or "nein" otherwise.
nuts: NUTS identifier based on the Eurostat regional
classification
ars_0: ARS identifier with trailing zeroes
ags_0: AGS identifier with trailing zeroes
wsk: Legally relevant date for the effectiveness of administrative changes
sn_l: Federal state component of the ARS
sn_r: Governmental district component of the ARS
sn_k: District component of the ARS
sn_v1: First part of the administrative association component of the ARS
sn_v2: Second part of the administrative association component of the ARS
sn_g: Municipality component of the ARS
fk_3: Purpose of the third key position. If "R", indicates the
government region, if "K", indicates the district
dkm_id: Identifier in the digital landscape model (DLM250)
ewz: Number of inhabitants
kfl: Land register area in square kilometers
Boundary geometries ("li") can have additional columns:
agz: Type of border. Can be one of
1: National border
2: State border
3: Governmental district border
4: District border
5: Administrative association border
6: Municipality border
9: Coastline
rdg: Legal definition of a border. Can be 1 (determined),
2 (not determined) or 9 (coastline)
gm5: Border characteristic of administrative association
borders (AGZ 5). Used to describe the purpose of these borders. Can
be 0 (characteristics by AGZ) or 8 (non-association border)
gmk: Border characteristic by coast/ocean. Specifies whether
a border runs a long a waterbody. Can be one of
7: borders on the ocean
8: auxiliary borders on the ocean
9: borders at the coastline
0: no characteristics
dlm_id: Identifier in the digital landscape model (DLM250)
Point geometries ("pk") have the following additional columns:
otl: Name of the locality in the digital landscale model (DLM250)
lon_dez: Decimal longitude
lat_dez: Decimal latitude
lon_gms: Geographical longitude
lat_gms: Geographical latitude
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
bkg_nuts for retrieving EU administrative areas
bkg_admin_hierarchy for the administrative hierarchy
bkg_ror, bkg_grid, bkg_kfz,
bkg_authorities for non-administrative regions
Datasets: admin_data, nuts_data
# You can use R-like operators to query the WFS bkg_admin(ags %LIKE% "05%") # districts in NRW bkg_admin(sn_l == "05") # does the same thing bkg_admin(gen %LIKE% "Ber%") # districts starting with Ber* # To query population and area, the key date must be December 31 bkg_admin(ewz > 500000, key_date = "1231") # districts over 500k people bkg_admin(kfl <= 100, key_date = "1231") # districts with low land register area # Using `gf == 9`, you can exclude waterbodies like oceans states <- bkg_admin(scale = "5000", level = "lan", gf == 9) plot(states$geometry) # Download historical data bkg_admin_archive(scale = "5000", level = "sta", year = "2021") # Download high-resolution data (takes a long time!) bkg_admin_highres(level = "lan")# You can use R-like operators to query the WFS bkg_admin(ags %LIKE% "05%") # districts in NRW bkg_admin(sn_l == "05") # does the same thing bkg_admin(gen %LIKE% "Ber%") # districts starting with Ber* # To query population and area, the key date must be December 31 bkg_admin(ewz > 500000, key_date = "1231") # districts over 500k people bkg_admin(kfl <= 100, key_date = "1231") # districts with low land register area # Using `gf == 9`, you can exclude waterbodies like oceans states <- bkg_admin(scale = "5000", level = "lan", gf == 9) plot(states$geometry) # Download historical data bkg_admin_archive(scale = "5000", level = "sta", year = "2021") # Download high-resolution data (takes a long time!) bkg_admin_highres(level = "lan")
Retrieve polygon geometries of municipalities in Germany with details on their relationships to administrative areas of higher levels in the territorial hierarchy. The output of this functions contains the identifiers and names of the NUTS1 to NUTS3 areas that each municipality belongs to.
This function interfaces the vz250 product of the BKG.
bkg_admin_hierarchy( key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE )bkg_admin_hierarchy( key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE )
key_date |
For |
year |
Version year of the dataset. You can use |
timeout |
Timeout value for the data download passed to
|
update_cache |
By default, downloaded files are cached in the
|
An sf tibble with multipolygon geometries similar to the output
of bkg_admin(level = "gem"). The tibble additionally contains
columns NUTS*_CODE and NUTS*_NAME giving the identifiers and
names of the administrative areas the municipalities belong to.
bkg_admin_hierarchy()bkg_admin_hierarchy()
Retrieve geographical names associated with official municipality keys
and regional keys. To retrieve their polygon geometries, see
bkg_admin.
These functions interface the wfs_gnde product of the BKG.
bkg_ags(..., filter = NULL, properties = NULL, max = NULL) bkg_ars(..., filter = NULL, properties = NULL, max = NULL)bkg_ags(..., filter = NULL, properties = NULL, max = NULL) bkg_ars(..., filter = NULL, properties = NULL, max = NULL)
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe containing the respective identifier and geographical
names related to their state, government region, district and municipality.
bkg_ars additionally returns the name of the administrative
association.
While other WFS interfaces like bkg_admin allow querying
using CQL or XML, bkg_ags and bkg_ars (using the GNDE service)
ONLY support XML. This has implications for the allowed query filters
(see wfs_filter).
bkg_geonames and bkg_endonyms for geographical names
# Either get geographical names for identifiers bkg_ars(ars == "01") # ... or identifiers for geographical names bkg_ars(gemeinde == "Köln")# Either get geographical names for identifiers bkg_ars(ars == "01") # ... or identifiers for geographical names bkg_ars(gemeinde == "Köln")
Retrieve international, regional, and special airports in Germany. Small landing sites are not included.
These functions interface the wfs_poi_open product of the BKG.
bkg_airports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_airports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe containing the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
poi_id: Unique primary key of a point of interest
icao_code: ICAO code of the airport
typ: Type of airport. Can be one of the following:
international: International airport
regional: Regional airport
Sonderflughafen: Special airport
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_crossings(),
bkg_heliports(),
bkg_kilometrage(),
bkg_seaports(),
bkg_stations(),
bkg_trauma_centers()
# Get all airports in NRW airports <- bkg_airports(ars %LIKE% "05%") nrw <- bkg_admin(level = "lan", sn_l == "05") plot(nrw$geometry) plot(airports$geometry, add = TRUE, pch = 16)# Get all airports in NRW airports <- bkg_airports(ars %LIKE% "05%") nrw <- bkg_admin(level = "lan", sn_l == "05") plot(nrw$geometry) plot(airports$geometry, add = TRUE, pch = 16)
Retrieves area code regions (Vorwahlgebiete) in Germany. Area code regions are based on the number of registered telephone numbers.
This function interfaces the wfs_gnde product of the BKG.
bkg_area_codes( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, max = NULL )bkg_area_codes( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
An sf dataframe containing polygon geometries and the area code
(vorwahl) associated with the region.
While other WFS interfaces like bkg_admin allow querying
using CQL or XML, bkg_area_codes ONLY supports XML. This has
implications for the allowed query filters (see wfs_filter).
bkg_geonames and bkg_endonyms for geographical names
Other non-administrative regions:
bkg_authorities(),
bkg_grid,
bkg_kfz(),
bkg_ror()
vorwahlen <- bkg_area_codes(vorwahl %LIKE% "0215%") plot(vorwahlen$geometry)vorwahlen <- bkg_area_codes(vorwahl %LIKE% "0215%") plot(vorwahlen$geometry)
Retrieve regions of administrative responsibility for job centers, employment agencies, offices of employment agencies, regional directorates of the Federal Employment Agency as well as local, regional, and higher regional courts.
This function interfaces the wfs_bzb-open product of the BKG.
bkg_authorities( authority, ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_authorities( authority, ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
authority |
Type of authority for which to retrieve regions of
responsibility. Must be one of |
||||||||||||||||||||||||||||||
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
An sf tibble with multipolygon geometries and the following columns:
id: Identifier of the authority region
dst_id: Identifier of the authority office
uebergeord: Name of the superior authority
name: Name of the authority
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other non-administrative regions:
bkg_area_codes(),
bkg_grid,
bkg_kfz(),
bkg_ror()
# Get only local courts that are subordinates of the regional court Cottbus bkg_authorities( authority = "local_courts", uebergeord %LIKE% "%Cottbus", uebergeord %LIKE% "Landgericht%" )# Get only local courts that are subordinates of the regional court Cottbus bkg_authorities( authority = "local_courts", uebergeord %LIKE% "%Cottbus", uebergeord %LIKE% "Landgericht%" )
Retrieve land cover polygons in Germany based on the Corine Land Cover (CLC) nomenclature. Corine Land Cover is a way to project by the European Commission to consistenly classify both land cover and land use.
This function interfaces the wfs_clc5_* products of the BKG.
bkg_clc( ..., year = "2018", bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_clc( ..., year = "2018", bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
year |
Version year of the dataset. You can use |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
An sf dataframe with polygon geometries and the following columns:
clc*: CLC land cover classes for the given year. An overview
of all CLC classes can be found in the
Copernicus documentation.
shape_length: Circumference of the polygon in meters
shape_area: Area of the polygon in square meters
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
# Get glaciers in Germany bkg_clc(clc18 == "335") # Get all coastal wetlands bkg_clc(clc18 %LIKE% "42%") # Get only wetlands in Lower Saxony lowsax <- bkg_admin(level = "lan", scale = "5000", sn_l == "03", gf == 9) wetlands <- bkg_clc(clc18 %LIKE% "4%", poly = lowsax, lang = "xml") plot(lowsax$geometry) plot(wetlands$geometry, add = TRUE)# Get glaciers in Germany bkg_clc(clc18 == "335") # Get all coastal wetlands bkg_clc(clc18 %LIKE% "42%") # Get only wetlands in Lower Saxony lowsax <- bkg_admin(level = "lan", scale = "5000", sn_l == "03", gf == 9) wetlands <- bkg_clc(clc18 %LIKE% "4%", poly = lowsax, lang = "xml") plot(lowsax$geometry) plot(wetlands$geometry, add = TRUE)
Retrieve border crossings in Germany. A road is a border crossing if it touches an international border and it continues on the foreign side. This includes ferry connections but not dirt roads.
bkg_crossings( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_crossings( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe with the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
ort: Name of the nearest place
strasse: Number or label of the border-crossing street
typ: Type of checkpoint; always "Straßenverkehr"
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_airports(),
bkg_heliports(),
bkg_kilometrage(),
bkg_seaports(),
bkg_stations(),
bkg_trauma_centers()
# Get all border crossings in Bavaria crossings <- bkg_crossings(bundesland == "Bayern") plot(crossings$geometry, pch = 16)# Get all border crossings in Bavaria crossings <- bkg_crossings(bundesland == "Bayern") plot(crossings$geometry, pch = 16)
Retrieve the digital elevation model (DEM) for the territory of Germany.
This function interfaces the wcs_dgm200_inspire product of the BKG.
bkg_dem(bbox = NULL, interpolation = NULL, epsg = 3035)bkg_dem(bbox = NULL, interpolation = NULL, epsg = 3035)
bbox |
An sf geometry or a boundary box vector of the format
|
interpolation |
Interpolation method to preprocess the raster.
Can be |
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
A SpatRaster containing elevation data.
wcs_dgm200_inspire documentation
library(sf) # Elevation around Hanover han <- st_sfc(st_point(c(9.738611, 52.374444)), crs = 4326) han <- st_buffer(st_transform(han, 3035), dist = 2000) dem <- bkg_dem(bbox = han) terra::plot(dem)library(sf) # Elevation around Hanover han <- st_sfc(st_point(c(9.738611, 52.374444)), crs = 4326) han <- st_buffer(st_transform(han, 3035), dist = 2000) dem <- bkg_dem(bbox = han) terra::plot(dem)
Retrieve objects from the digital landscape model (DLM). DLMs are a description of topographical objects of a landscape. Many other services from the BKG are derived from the DLM.
Although this function lets you download each feature type in the DLM, you still need to know about what data is available and what the features in the output actually mean. Since the DLM gets pretty complicated, you are advised to take a look at the GeoInfoDok object type catalog.
This function interfaces the dlm* products of the BKG.
bkg_dlm( type, ..., shape = c("point", "line", "polygon"), scale = c("250", "1000"), bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_dlm( type, ..., shape = c("point", "line", "polygon"), scale = c("250", "1000"), bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
type |
Feature type of the DLM. Can either be the identifier
(e.g., 41010) or its description (e.g., Siedlungsflaeche). The description
can either be prefixed with Note that not all feature types are available for all shapes (see the
|
||||||||||||||||||||||||||||||
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
shape |
Geometry type of the feature type. Must be one of |
||||||||||||||||||||||||||||||
scale |
Scale of the geometries. Can be |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
An sf tibble with the geometry suggested by shape.
The columns can vary depending of the selected feature type. The meanings
of the columns can also change depending on the feature type. Check out
the GeoInfoDok object type catalog for a detailed documentation of the
DLM metadata. Some more general columns are included for all feature types;
these include:
id: Identifier of an object
land: ISO-2 code of the country, usually DE
modellart: Model type
objart: Feature type of the digital landscape model (DLM)
objart_txt: Title of the feature type
objid: Unique object identifier
beginn: Creation of the object in the DLM
ende: Deletion of the object from the DLM
objart_z: Object type of the composite object (ZUSO)
objid_z: Object type of the composite object (ZUSO)
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
# Retrieve all train tracks in Leipzig library(sf) lzg <- st_sfc(st_point(c(12.37475, 51.340333)), crs = 4326) lzg <- st_buffer(st_transform(lzg, 3035), dist = 10000, endCapStyle = "SQUARE") tracks <- bkg_dlm("Bahnstrecke", shape = "line", poly = lzg) tracks plot(lzg) plot(tracks$geometry, add = TRUE) # Filter all tracks that are not rail cargo bkg_dlm("Bahnstrecke", shape = "line", poly = lzg, bkt == "1102") # Directly providing the identifier is faster bkg_dlm("42014", shape = "line", poly = lzg)# Retrieve all train tracks in Leipzig library(sf) lzg <- st_sfc(st_point(c(12.37475, 51.340333)), crs = 4326) lzg <- st_buffer(st_transform(lzg, 3035), dist = 10000, endCapStyle = "SQUARE") tracks <- bkg_dlm("Bahnstrecke", shape = "line", poly = lzg) tracks plot(lzg) plot(tracks$geometry, add = TRUE) # Filter all tracks that are not rail cargo bkg_dlm("Bahnstrecke", shape = "line", poly = lzg, bkt == "1102") # Directly providing the identifier is faster bkg_dlm("42014", shape = "line", poly = lzg)
Get geographic names including toponyms and endonyms. bkg_geonames
retrieves the geographical "objects" based on the digital landscape model
(DLM). These objects contain a set of metadata and a national name identifier
(NNID). These NNIDs can be used to join with the endonyms related to a
geographical object (bkg_endonyms).
These functions interface the wfs_gnde product of the BKG.
bkg_geonames( ..., names = TRUE, ags = FALSE, dlm = FALSE, status = FALSE, bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL ) bkg_endonyms(..., filter = NULL, properties = NULL, max = NULL)bkg_geonames( ..., names = TRUE, ags = FALSE, dlm = FALSE, status = FALSE, bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL ) bkg_endonyms(..., filter = NULL, properties = NULL, max = NULL)
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
names |
If |
||||||||||||||||||||||||||||||
ags |
If |
||||||||||||||||||||||||||||||
dlm |
If |
||||||||||||||||||||||||||||||
status |
If |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
These functions make use of the GN-DE WFS, just like bkg_ags,
bkg_ars, and bkg_area_codes. The infrastructure
behind it is actually quite sophisticated and this function may not live
up to these standards. You can use bkg_feature_types and
bkg_wfs to manually explore the service's endpoints if
required.
A dataframe containing the following columns:
nnid: National name identifier
landesCode: Country identifier; 276 is Germany.
beschreibung: Optional details
geoLaenge: Geographical longitude
geoBreite: Geographical latitude
hoehe: Elevation above sea level
hoeheger: Computed elevation above sea level
groesse: Undocumented, but I guess this relates to the suggested print
size of the labels
ewz: Number of inhabitants
ewzger: Computed number of inhabitants
ags: Official municipality key (Amtlicher Gemeindeschlüssel).
Related to the ARS but shortened to omit position 6 to 9. Structured as
follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-8: Municipality
gemteil: Whether the place is part of a municipality
virtuell: Whether the place is a real or virtual locality
ars: Territorial code (Amtlicher Regionalschlüssel).
The ARS is stuctured hierarchically as follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-9: Administrative association
Position 10-12: Municipality
If ags = TRUE, adds the output of bkg_ags. If
dlm = TRUE, adds a column dlm_id containing identifiers of
bkg_dlm.
bkg_endonyms contains the following columns:
name: Name of the geographical object
geschlecht: If applicable, the grammatical gender of a geographical name
These are also included in the output of bkg_geonames if
names = TRUE.
While other WFS interfaces like bkg_admin allow querying
using CQL or XML, bkg_geonames and bkg_endonyms (using the
GNDE service) ONLY support XML. This has implications for the allowed
query filters (see wfs_filter).
bkg_ags and bkg_ars for geographical names
of administrative areas
# Plot geographical objects in Cologne library(sf) library(ggplot2) cgn <- st_sfc(st_point(c(6.956944, 50.938056)), crs = 4326) cgn <- st_buffer(st_transform(cgn, 3035), dist = 500) cgn_names <- bkg_geonames(poly = cgn) st_geometry(cgn_names) <- st_centroid(st_geometry(cgn_names)) cgn_names <- cgn_names[lengths(st_intersects(cgn_names, cgn)) > 0, ] ggplot(cgn_names) + geom_sf_text(aes(label = name)) + theme_void()# Plot geographical objects in Cologne library(sf) library(ggplot2) cgn <- st_sfc(st_point(c(6.956944, 50.938056)), crs = 4326) cgn <- st_buffer(st_transform(cgn, 3035), dist = 500) cgn_names <- bkg_geonames(poly = cgn) st_geometry(cgn_names) <- st_centroid(st_geometry(cgn_names)) cgn_names <- cgn_names[lengths(st_intersects(cgn_names, cgn)) > 0, ] ggplot(cgn_names) + geom_sf_text(aes(label = name)) + theme_void()
Retrieve geometries of INSPIRE-compliant grid geometries (also called
"GeoGitter"). bkg_grid_fast() is much faster than bkg_grid_full()
by downloading heavily compressed versions grids. This happens at the cost
of data richness as bkg_grid_fast() only contains the geometries and
nothing else. Note that the arrow package needs to be installed to
use bkg_grid_fast().
Note that the output contains point geometries. Most of the times, you
want to work with rasters instead. To convert a given object out,
type the following (terra package required):
terra::rast(out)
These functions interface the GeoGitter product of the BKG.
bkg_grid_fast( year = c("2019", "2018", "2017", "2015"), resolution = c("100km", "10km", "5km", "1km", "250m", "100m"), timeout = 600, update_cache = FALSE ) bkg_grid_full( year = "latest", resolution = c("100km", "10km", "5km", "1km", "250m", "100m"), timeout = 600, update_cache = FALSE )bkg_grid_fast( year = c("2019", "2018", "2017", "2015"), resolution = c("100km", "10km", "5km", "1km", "250m", "100m"), timeout = 600, update_cache = FALSE ) bkg_grid_full( year = "latest", resolution = c("100km", "10km", "5km", "1km", "250m", "100m"), timeout = 600, update_cache = FALSE )
year |
Version of the grid. Can be |
resolution |
Cell size of the grid. Can be |
timeout |
Timeout value for the data download passed to
|
update_cache |
By default, downloaded files are cached in the
|
The following table gives a rough idea of how much less data
bkg_grid_fast needs to download for each resolution compared to
bkg_grid_full.
| Size | fast | full |
| 100km | 0.78 kB | 933 kB |
| 10km | 2.68 kB | 1,015 kB |
| 5km | 3.53 kB | 1,253 kB |
| 1km | 28.7 kB | 5,249 kB |
| 500m | 133 kB | 15,902 kB |
| 250m | 289 kB | 53,900 kB |
| 100m | 1,420 kB | 291,000 kB |
bkg_grid_fast returns an sf dataframe with point geometries
and no features. bkg_grid_full also returns point geometries but
with the following additional features:
x_sw: X coordinate of the South-West corner of a grid cell
y_sw: Y coordinate of the South-West corner of a grid cell
f_staat: State area in the grid cell in square meters
f_land: Land area in the grid cell in square meters
f_wasser: Water area in the grid cell in square meters
p_staat: Share of state area in the grid cell
p_land: Share of land area in the grid cell
p_wasser: Share of water area in the grid cell
ags: Official municipality key (Amtlicher Gemeindeschlüssel).
Related to the ARS but shortened to omit position 6 to 9. Structured as
follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-8: Municipality
Note that ags is only included for resolutions "100m" and
"250m"
Other non-administrative regions:
bkg_area_codes(),
bkg_authorities(),
bkg_kfz(),
bkg_ror()
# Return a bare-bones version of the INSPIRE grid grid <- bkg_grid_fast(year = "2019", resolution = "100km") # Return a fully detailed version instead grid_full <- bkg_grid_full(resolution = "5km") plot(grid) # Convert grid to SpatRaster if (requireNamespace("terra")) { library(terra) raster <- rast(vect(grid_full["p_wasser"]), type = "xyz") plot(raster, main = "Share of water area") }# Return a bare-bones version of the INSPIRE grid grid <- bkg_grid_fast(year = "2019", resolution = "100km") # Return a fully detailed version instead grid_full <- bkg_grid_full(resolution = "5km") plot(grid) # Convert grid to SpatRaster if (requireNamespace("terra")) { library(terra) raster <- rast(vect(grid_full["p_wasser"]), type = "xyz") plot(raster, main = "Share of water area") }
Get heliports in Germany. Based on data from third-party providers and image classification of aerial imagery.
bkg_heliports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_heliports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe with the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
code: Identifier of the heliport
name_bkg: Name of the landing site according to BKG
name_dfs: Name of the landing size according to Deutsche
Flugsicherung (DFS)
airport_pk: Identifier according to the LFS aviation manual
befestigun: Pavement type of the landing site. Can be:
befestigt: paved
teilweise befestigt: partially paved
unbefestigt: unpaved
kennzeich: Marking of the landing size. Can be:
gekennzeichnet: marked
nicht gekennzeichnet: not marked
lage: Location of the landing size. Can be:
D: Roof
F: Field
PG: Platform next to a hospital
W: Pasture
LP: Landing site
PP: Parking lot
LP / W: Paved landing size on pasture
F / W: Field or pasture
LP / Str.: Landing size next to a street
typ: Type of heliport. Can be:
H: Heliport
HH: Heliport at a hospital
MH: Military heliport
typ2: Additional heliport type for landing sites with an
air rescue station. Can be:
HRLS: Helicopter air rescue station
ITH: Intensive transport helicopter
betreiber: Operator of the heliport
helikopter: Name of the helicopter belonging to the
air rescue station
status: Whether the point geometry was edited by the BKG.
Can be:
Original: not edited
Verschoben: moved
neu: newly added
quelle: Source of the information. Can be:
BKG: Own research by the BKG
DFS-Liste: Provided by DFS
LBA-Liste: Provided by the Federal Aviation Office (LBA)
MHW: Provided by the Medical Disaster Relief Organization (MHW)
RTH.Info: Provided by rth.info
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_airports(),
bkg_crossings(),
bkg_kilometrage(),
bkg_seaports(),
bkg_stations(),
bkg_trauma_centers()
# Get only military heliports bkg_heliports(typ == "MH") # Get only rooftop heliports bkg_heliports(lage == "D")# Get only military heliports bkg_heliports(typ == "MH") # Get only rooftop heliports bkg_heliports(lage == "D")
Retrieve motor vehicle registration plate regions in Germany. Registration plate regions are discerned by their area code (Unterscheidungszeichen) which indicate the place where a vehicle was registered. These regions partially overlap with districts but are not entirely identical.
This function interfaces the wfs_kfz250 product of the BKG.
bkg_kfz( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_kfz( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
An sf dataframe with multipolygon geometries and the following columns:
debkgid: Identifier in the digital landscape model DLM250
nnid: National name identifier
name: Name of the geographical object
ars: Territorial code (Amtlicher Regionalschlüssel).
The ARS is stuctured hierarchically as follows:
Position 1-2: Federal state
Position 3: Government region
Position 4-5: District
Position 6-9: Administrative association
Position 10-12: Municipality
oba: Name of the ATKIS object type
kfz: Vehicle registration area code, comma-separated in case of multiple codes
geola: Geographical longitude
geobr: Geographical latitude
gkre: Gauß-Krüger easting
gkho: Gauß-Krüger northing
utmre: UTM easting
utmho: UTM northing
Other non-administrative regions:
bkg_area_codes(),
bkg_authorities(),
bkg_grid,
bkg_ror()
library(ggplot2) kfz <- bkg_kfz(ars %LIKE% "053%") ggplot(kfz) + geom_sf(fill = NA) + geom_sf_text(aes(label = kfz)) + theme_void()library(ggplot2) kfz <- bkg_kfz(ars %LIKE% "053%") ggplot(kfz) + geom_sf(fill = NA) + geom_sf_text(aes(label = kfz)) + theme_void()
Get kilometrages of German federal motorways. Kilometrages are markers for each kilometer of a highway. They can be used to create linear referencing systems (LRS).
bkg_kilometrage( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_kilometrage( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe containing the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
bez: Label of the federal motorway
kilometer: Kilometrage of the motorway
richtung: Direction of the kilometrage
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
The rLFT package for linear referencing
Other points of interest:
bkg_airports(),
bkg_crossings(),
bkg_heliports(),
bkg_seaports(),
bkg_stations(),
bkg_trauma_centers()
# Get the kilometrage of the A2 motorway a2 <- bkg_kilometrage(bez == "A2") plot(a2["kilometer"], pch = 16)# Get the kilometrage of the A2 motorway a2 <- bkg_kilometrage(bez == "A2") plot(a2["kilometer"], pch = 16)
Retrieve polygons of NUTS regions.
This function interfaces the nuts* products of the BKG.
bkg_nuts( level = c("1", "2", "3"), scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE )bkg_nuts( level = c("1", "2", "3"), scale = c("250", "1000", "2500", "5000"), key_date = c("0101", "1231"), year = "latest", timeout = 120, update_cache = FALSE )
level |
NUTS level to download. Can be |
scale |
Scale of the geometries. Can be |
key_date |
For |
year |
Version year of the dataset. You can use |
timeout |
Timeout value for the data download passed to
|
update_cache |
By default, downloaded files are cached in the
|
An sf dataframe with multipolygon geometries and the following columns:
GF: Integer representing the geofactor; whether an area is
"structured" or not. Land is structured if it is part of a state or other
administrative unit but is not further divided into administrative units.
Can be one of
1: Unstructured, waterbody
2: Structured, waterbody
3: Unstructured, land
4: Structured, land
NUTS_LEVEL: NUTS level. Can be one of
1: NUTS-1; federal states
2: NUTS-2; inconsistent, somewhere between government regions and federal states
3: NUTS-3; districts
NUTS_CODE: Hierarchical key of the NUTS region. Can have a different number
of characters depending on the NUTS level:
NUTS-1: three digits
NUTS-2: four digits
NUTS-3: five digits
NUTS_NAME: Geographical name of the NUTS region
This function does not query a WFS so you are only able to download entire datasets without the ability to filter beforehand.
bkg_admin for retrieving German administrative areas
Datasets: admin_data, nuts_data
# Download NUTS state data from 2020 bkg_nuts(scale = "5000", year = 2020) # Download the latest NUTS district data bkg_nuts(level = "3")# Download NUTS state data from 2020 bkg_nuts(scale = "5000", year = 2020) # Download the latest NUTS district data bkg_nuts(level = "3")
Retrieves the "German Combined Quasigeoid", the official height reference surface of the German land survey above the reference ellipsoid (GRS80).
A quasigeoid is an approximation of the geoid surface used to define normal heights above the earth's surface that is based on more practical assumptions than a true geoid. It defines heights in meters that can be more meaningful than ellipsoidal heights in many applications like surveying, hydrological modeling, engineering, or spatial analysis.
This function interfaces the quasigeoid product of the BKG.
bkg_quasigeoid( year = "latest", region = c("all", "coast", "no", "nw", "s", "w"), timeout = 120, update_cache = FALSE )bkg_quasigeoid( year = "latest", region = c("all", "coast", "no", "nw", "s", "w"), timeout = 120, update_cache = FALSE )
year |
Version year of the dataset. You can use |
region |
Subterritory of Germany. |
timeout |
Timeout value for the data download passed to
|
update_cache |
By default, downloaded files are cached in the
|
A SpatRaster containing normal heights
for the specified region. The data comes in EPSG:4258 and a
resolution of 30" x 45" (approximately 0.9 x 0.9 km).
library(terra) qgeoid <- bkg_quasigeoid(region = "no") terra::plot(qgeoid)library(terra) qgeoid <- bkg_quasigeoid(region = "no") terra::plot(qgeoid)
Retrieve areal data related to what the BKG calls non-administrative regions. This includes:
bkg_ror: Raumordnungsregionen (Spatial planning regions)
bkg_rg: Reisegebiete (Travel areas)
bkg_amr: Arbeitsmarktregionen (Labor market regions)
bkg_bkr: Braunkohlereviere (Lignite regions)
bkg_krg: Kreisregionen (District regions)
bkg_mbe: BBSR Mittelbereiche (BBSR middle areas)
bkg_ggr: Großstadtregionen (City regions)
bkg_kmr: Metropolregionen (Metropolitan regions)
bkg_mkro: Verdichtungsräume (Conurbations)
These functions interface the ge* product of the BKG.
bkg_ror( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_rg( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_amr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_bkr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_krg( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_mbe( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_ggr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_kmr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_mkro( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE )bkg_ror( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_rg( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_amr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_bkr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_krg( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_mbe( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_ggr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_kmr( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE ) bkg_mkro( scale = c("250", "1000", "2500", "5000"), year = "latest", timeout = 120, update_cache = FALSE )
scale |
Scale of the geometries. Can be |
year |
Version year of the dataset. You can use |
timeout |
Timeout value for the data download passed to
|
update_cache |
By default, downloaded files are cached in the
|
An sf tibble with multipolygon geometries and two features, a regional identifier and the region endonyms.
Other non-administrative regions:
bkg_area_codes(),
bkg_authorities(),
bkg_grid,
bkg_kfz()
Retrieve seaports to the North and Baltic Sea in Northern Germany.
bkg_seaports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_seaports( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe containing the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
poi_id: Unique primary key of a point of interest
betreiber: Operator of the seaport
homepage: Homepage of the operator
typ: Type of seaport. Can be "Seehafen" (seaport) or
"See- und Binnenhafen" (sea and inland port)
art: Type of seaport by freight. Can be:
Güter: Goods
Güter und Passagiere: Goods and passengers
Passagiere: Passengers
quelle: Source of the information. Can be:
BSH: Federal Maritime and Hydrographic Agency
MarWiLo: Maritime Wirtschaft & Logistik
ZDS-Seehäfen: Zentralverband der deutschen Seehafenbetriebe
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_airports(),
bkg_crossings(),
bkg_heliports(),
bkg_kilometrage(),
bkg_stations(),
bkg_trauma_centers()
# Get only seaports that co-function as inland ports ports <- bkg_seaports(typ == "See- und Binnenhafen") germany <- bkg_admin(level = "sta", scale = "5000", gf == 9) plot(germany$geometry) plot(ports$geometry, add = TRUE)# Get only seaports that co-function as inland ports ports <- bkg_seaports(typ == "See- und Binnenhafen") germany <- bkg_admin(level = "sta", scale = "5000", gf == 9) plot(germany$geometry) plot(ports$geometry, add = TRUE)
Retrieve data on public transport stations and stops in Germany. Stations and stops are hierarchical. This means that stations represent the structural facilities as hierarchically superior objects and stops are hierarchically inferiors parts of a station (e.g., a single platform at a bus stop).
bkg_stations( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_stations( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe with the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
stop_id: Identifier of the station or stop
parent_st: Identifier of the parent station if applicable
verkehrsm: Vehicle used at the station, comma-separated
and sorted alphabetically
art: Hierarchical position of a station. Can be:
Station: A physical structure and hierarchically superior
Haltestelle: Part of a structure and hierarchically inferior
tag_f_awo: Mean departures per day in a work week
tag_f_wo: Mean departures per day in a full week
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_airports(),
bkg_crossings(),
bkg_heliports(),
bkg_kilometrage(),
bkg_seaports(),
bkg_trauma_centers()
# Get all long-distance train stations bkg_stations(verkehrsm %LIKE% "%Fernzug%", art == "Station") # Get all platforms of long-distance train stations bkg_stations(verkehrsm %LIKE% "%Fernzug%", art == "Haltestelle") # Get all stops with high traffic bkg_stations(tag_f_awo > 1000, art == "Station") # Get all bus stops with low traffic bkg_stations(tag_f_awo < 1, verkehrsm %LIKE% "%Bus%", art == "Station")# Get all long-distance train stations bkg_stations(verkehrsm %LIKE% "%Fernzug%", art == "Station") # Get all platforms of long-distance train stations bkg_stations(verkehrsm %LIKE% "%Fernzug%", art == "Haltestelle") # Get all stops with high traffic bkg_stations(tag_f_awo > 1000, art == "Station") # Get all bus stops with low traffic bkg_stations(tag_f_awo < 1, verkehrsm %LIKE% "%Bus%", art == "Station")
Retrieve data on trauma centers in Germany. A trauma center is a hospital certified by the German Society for Trauma Surgery (DGU) that is able to provide maximum care for heavily injured people. Trauma centers are organized in a hierarchical regional network that ranges from local to transregional centers.
bkg_trauma_centers( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )bkg_trauma_centers( ..., bbox = NULL, poly = NULL, predicate = "intersects", filter = NULL, epsg = 3035, properties = NULL, max = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
epsg |
An EPSG code specifying a coordinate reference system of the
output. If you're unsure what this means, try running
|
||||||||||||||||||||||||||||||
properties |
Vector of columns to include in the output. |
||||||||||||||||||||||||||||||
max |
Maximum number of results to return. |
A dataframe containing the following columns:
name: Geographical name of the POI
gemeinde: Municipality name
verwaltung: Administrative association name
kreis: District name
regierungs: Government region name
bundesland: Federal state name
poi_id: Unique primary key of a point of interest
tz_nummer: Unique primary key of the trauma center
strasse: Street
hn: House number
plz: Zip code
ort: Place name
netwerk: Name of the regional trauma center network
abteilung: Name of the medical department
typ: Type of trauma center. Can be:
LTZ: local trauma center
RTZ: regional trauma center
ÜTZ: transregional trauma center
By default, WFS requests use CQL (Contextual Query Language) queries for
simplicity. CQL queries only work together with GET requests. This means
that when the URL is longer than 2048 characters, they fail.
While POST requests are much more flexible and able to accommodate long
queries, XML is really a pain to work with and I'm not confident in my
approach to construct XML queries. You can control whether to send GET or
POST requests by setting options(ffm_query_language = "XML")
or options(ffm_query_language = "CQL").
Other points of interest:
bkg_airports(),
bkg_crossings(),
bkg_heliports(),
bkg_kilometrage(),
bkg_seaports(),
bkg_stations()
# Get only trauma centers specializing on orthopedics bkg_trauma_centers(abteilung %LIKE% "%orthopäd%") # Get only local trauma centers bkg_trauma_centers(typ == "LTZ") if (requireNamespace("ggplot2")) { library(ggplot2) centers <- bkg_trauma_centers() ggplot() + geom_sf( data = centers[centers$typ %in% "LTZ",], size = 1, color = "lightblue1" ) + geom_sf( data = centers[centers$typ %in% "RTZ",], size = 2, color = "lightblue3" ) + geom_sf( data = centers[centers$typ %in% "ÜTZ",], size = 3, color = "lightblue4" ) + theme_void() }# Get only trauma centers specializing on orthopedics bkg_trauma_centers(abteilung %LIKE% "%orthopäd%") # Get only local trauma centers bkg_trauma_centers(typ == "LTZ") if (requireNamespace("ggplot2")) { library(ggplot2) centers <- bkg_trauma_centers() ggplot() + geom_sf( data = centers[centers$typ %in% "LTZ",], size = 1, color = "lightblue1" ) + geom_sf( data = centers[centers$typ %in% "RTZ",], size = 2, color = "lightblue3" ) + geom_sf( data = centers[centers$typ %in% "ÜTZ",], size = 3, color = "lightblue4" ) + theme_void() }
Low-level interface to BKG-style web coverage services (WCS). This function
is used in all high-level functions of ffm that depend on a WCS,
e.g., bkg_dem.
bkg_wcs( coverage_id, endpoint = coverage_id, version = "2.0.1", method = NULL, format = "image/tiff;application=geotiff", epsg = 3035, interpolation = NULL, ... )bkg_wcs( coverage_id, endpoint = coverage_id, version = "2.0.1", method = NULL, format = "image/tiff;application=geotiff", epsg = 3035, interpolation = NULL, ... )
coverage_id |
Coverage ID. When in doubt, inspect the
|
endpoint |
Endpoint to interface. Note that |
version |
Service version of the WCS. Defaults to |
method |
HTTP method to use for the request. If |
format |
Content type of the output. This value heavily depends
the endpoint queried. Defaults to |
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 |
interpolation |
Method used to interpolate the coverage raster. Allowed methods depend on the capabilities of the WCS. |
... |
Further parameters passed to the WFS query. In case of
|
A SpatRaster.
# Boundaries can be provided using two subset arguments bkg_wcs( "dgm200_inspire__EL.GridCoverage", endpoint = "dgm200_inspire", subset = "E(548282,552280)", subset = "N(5800943,5804942)" )# Boundaries can be provided using two subset arguments bkg_wcs( "dgm200_inspire__EL.GridCoverage", endpoint = "dgm200_inspire", subset = "E(548282,552280)", subset = "N(5800943,5804942)" )
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.
bkg_wfs( type_name, endpoint = type_name, version = "2.0.0", method = NULL, format = "application/json", layer = NULL, epsg = 3035, properties = NULL, filter = NULL, server = sgx_base(), ... ) bkg_feature_types(endpoint, server = sgx_base())bkg_wfs( type_name, endpoint = type_name, version = "2.0.0", method = NULL, format = "application/json", layer = NULL, epsg = 3035, properties = NULL, filter = NULL, server = sgx_base(), ... ) bkg_feature_types(endpoint, server = sgx_base())
type_name |
Feature type of the WFS to retrieve. You can use
|
endpoint |
Endpoint to interface. Note that |
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. If |
format |
Content type of the output. This value heavily depends
the endpoint queried. Most services allow |
layer |
If |
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 |
properties |
Names of columns to include in the output. Defaults to
|
filter |
A WFS filter query (CQL or XML) created by
|
server |
WFS server domain to use. Defaults to the SGX spatial data center of the BKG. |
... |
Further parameters passed to the WFS query. In case of
|
An sf tibble
bkg_wcs for a low-level WCS interface
wfs_filter for filter constructors
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]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]
MULTIPOLYGONsThree sf dataframes containing all geometries of
German NUTS1, NUTS2, and NUTS3 regions, respectively. The reference year
is 2023.
These datasets can be very useful for quickly retrieving pre-loaded boundaries without download.
bkg_nuts1 bkg_nuts2 bkg_nuts3bkg_nuts1 bkg_nuts2 bkg_nuts3
For the dataframe format, see bkg_nuts.
An object of class sf (inherits from tbl_df, tbl, data.frame) with 38 rows and 7 columns.
An object of class sf (inherits from tbl_df, tbl, data.frame) with 400 rows and 7 columns.
© BKG (2025) dl-de/by-2-0, data sources: https://sgx.geodatenzentrum.de/web_public/gdz/datenquellen/datenquellen_vg_nuts.pdf
Other datasets:
admin_data
bkg_nuts1bkg_nuts1
Utility functions to construct XML or CQL queries. These functions are the
backend of the filter argument in the filter capabilities of all
ffm functions that interact with a WFS (e.g., bkg_admin,
bkg_clc or bkb_geonames).
wfs_filter( ..., filter = NULL, bbox = NULL, poly = NULL, predicate = "intersects", geom_property = "geom", default_crs = 25832, lang = NULL )wfs_filter( ..., filter = NULL, bbox = NULL, poly = NULL, predicate = "intersects", geom_property = "geom", default_crs = 25832, lang = NULL )
... |
Used to construct CQL filters. Dot arguments accept an R-like
syntax that is converted to CQL queries internally. These queries basically
consist of a property name on the left, an aribtrary vector on the right,
and an operator that links both sides. If multiple queries are provided,
they will be chained with
To construct more complex queries, you can use the |
||||||||||||||||||||||||||||||
filter |
A character string containing a valid CQL or XML filter. This
string is appended to the query constructed through |
||||||||||||||||||||||||||||||
bbox |
An sf geometry or a boundary box vector of the format
|
||||||||||||||||||||||||||||||
poly |
An sf geometry. Used as a geometric filter to include
only those geometries that relate to |
||||||||||||||||||||||||||||||
predicate |
A spatial predicate that is used to relate the output
geometries with the object specified in |
||||||||||||||||||||||||||||||
geom_property |
Name of the geometry property included in the WFS.
In most cases, this is |
||||||||||||||||||||||||||||||
default_crs |
A WFS defines a default CRS in which coordinates for
spatial filtering have to be provided. For BKG services, this is usually
EPSG:25832. All sf objects provided through |
||||||||||||||||||||||||||||||
lang |
Query language to use for constructing the query. One of
|
A CQL query or an XML query depending on the lang argument.
# CQL and XML support mostly the same things wfs_filter(ags %LIKE% "05%", lang = "cql") wfs_filter(ags %LIKE% "05%", lang = "xml") bbox <- c(xmin = 5, ymin = 50, xmax = 7, ymax = 52) wfs_filter(bbox = bbox, lang = "cql") wfs_filter(bbox = bbox, lang = "xml") # Using `filter`, more complex queries can be built wfs_filter(ars %LIKE% "%0", filter = "regierungs NOT IS NULL") wfs_filter( filter = "<fes:Not> <fes:PropertyIsNull> <fes:ValueReference>aussprache</fes:ValueReference> </fes:PropertyIsNull> </fes:Not>", lang = "xml" )# CQL and XML support mostly the same things wfs_filter(ags %LIKE% "05%", lang = "cql") wfs_filter(ags %LIKE% "05%", lang = "xml") bbox <- c(xmin = 5, ymin = 50, xmax = 7, ymax = 52) wfs_filter(bbox = bbox, lang = "cql") wfs_filter(bbox = bbox, lang = "xml") # Using `filter`, more complex queries can be built wfs_filter(ars %LIKE% "%0", filter = "regierungs NOT IS NULL") wfs_filter( filter = "<fes:Not> <fes:PropertyIsNull> <fes:ValueReference>aussprache</fes:ValueReference> </fes:PropertyIsNull> </fes:Not>", lang = "xml" )