MyNixOS website logo
Description

Download Official Spatial Data from Germany.

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.

ffm

R-CMD-check Codecov testcoverage CRANstatus Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. Downloads CodeFactor

{ffm} is an R package that provides quick and easy access to data from the geodata center of Germany’s Federal Agency for Cartography and Geodesy (BKG). The BKG is the official provider of spatial data in Germany and provides quite a few datasets as open data. These data range from administrative areas to earth observation data and are often crucial when working with regional statistics from Germany. Part of the motivation for this package stems from frustration when working areal identifiers returned by packages like {wiesbaden} or {restatis} and not being able to quickly link them to their spatial representations.

The name ffm is based on the colloquial short name of Frankfurt am Main where the BKG’s headquarters are located.

Gallery

The following examples were created using {ffm}. You can see their code in the examples/ directory.

Installation

You can install the development version of ffm from GitHub with:

# install.packages("pak")
pak::pak("jslth/ffm")

Example

Retrieving data is pretty straightforward:

library(ffm)
districts <- bkg_admin(level = "krs", scale = "5000")

Code for the plot

library(ggplot2)

ggplot(districts) +
  geom_sf(fill = NA) +
  theme_void()

The package makes it easy to go deeper than just getting the data. In many functions, you can use spatial filters.

districts <- bkg_admin(
  level = "krs",
  scale = "5000",
  bbox = c(xmin = 700000, ymin = 5900000, xmax = 850000, ymax = 6000000),
  predicate = "intersects"
)
districts$label <- ifelse(
  districts$bez == "Kreisfreie Stadt",
  paste("Stadt", districts$gen),
  districts$gen
)

Code for the plot

library(ggrepel)

ggplot(districts) +
  geom_sf(fill = NA) +
  geom_text_repel(
    aes(label = label, geometry = geometry),
    stat = "sf_coordinates",
    size = 3
  ) +
  theme_void()

Attribute filters are supported using an R-like syntax.

munics <- bkg_admin(
  level = "gem",
  key_date = "1231",
  sn_l %in% c("08", "09")
)

Code for the plot

munics$popdens <- munics$ewz / munics$kfl
munics$popdens[munics$popdens == 0] <- NA
ggplot(munics) +
  geom_sf(aes(fill = popdens), color = NA) +
  scale_fill_viridis_b("Population / km²", transform = "log10") +
  ggtitle("Population density in Southern Germany") +
  theme_void()

Supported products

FunctionDescriptionBKG products
bkg_adminAdministrative boundaries at different spatial scales; includes country, state, government region, district, administrative associations, and municipalitiesvg250 and related products
bkg_admin_hierarchyAdministrative boundaries containing details on their relationship to administrative areas of higher levels in the territorial hierarchyvz250
bkg_admin_highresAdministrative boundaries at a significantly lower resolution that provided by bkg_admin()vg25
bkg_agsGeographical names associated with official keys (AGS and ARS)wfs_gnde
bkg_airportsInternational, regional, and special airports in Germanywfs_poi_open
bkg_amrLabor market regions (Arbeitsmarktregionen)ge250 and related products
bkg_area_codesArea code regions (Vorwahlgebiete)wfs_gnde
bkg_arsGeographical names associated with official keys (AGS and ARS)wfs_gnde
bkg_authoritiesRegions of administrative responsibility for several agencies (Behördenzuständigkeitsbereiche)wfs_bzb_open
bkg_bkrLignite extraction regions (Braunkohlereviere)ge250 and related products
bkg_clcLand cover areas based on the Corine Land Cover (CLC) nomenclaturewfs_clc5
bkg_crossingsInternational border crossingswfs_poi_open
bkg_demElevation raster from the digital elevation model (DEM)dgm200
bkg_dlmTopographical objects of a landscape from the Digital Landscape Model (DLM)dlm250 and related products
bkg_endonymsGeographic names as endonymswfs_gnde
bkg_geonamesGeographic name metadata based on National Name Identifiers (NNID)wfs_gnde
bkg_ggrCity regions (Großstadtregionen)ge250 and related products
bkg_grid_fullINSPIRE-compliant grid geometries (GeoGitter)GeoGitter
bkg_heliportsHeliportswfs_poi_open
bkg_kfzVehicle registration plate regions (KFZ-Kennzeichen)kfz250
bkg_kilometrageKilometrages of German federal motorwayswfs_poi_open
bkg_kmrMetropolitan regions (Metropolregionen)ge250 and related products
bkg_krgDistrict regions (Kreisregionen)ge250 and related products
bkg_mbeBBSR Mittelbereichege250 and related products
bkg_mkroConurbations (Verdichtungsräume)ge250 and related products
bkg_nutsNUTS regions of scale 1 to 3 from the EU territorial divisionbkg_nuts250 and related products
bkg_quasigeoidGerman Combined Quasigeoid, the official height reference surface of the German land surveyquasigeoid
bkg_rgTravel areas (Reisegebiete)ge250 and related products
bkg_rorSpatial planning regions (Raumordnungsregionen)ge250 and related products
bkg_seaportsSeaports to the North and Baltic Seawfs_poi_open
bkg_stationsPublic transport stations and stopswfs_poi_open
bkg_trauma_centersTrauma centerswfs_poi_open

Related packages

  • {giscoR} for retrieving EU geodata (also including Germany)
  • {bonn} for retrieving German areal indicators with official identifiers
  • {restatis} and {wiesbaden} for retrieving regional statistics from Germany
  • {z22} for retrieving gridded German census data
  • {rdwd} for retrieving German weather and climate data

Copyright notice

BKG geodata is provided free of charge but remains copyrighted and subject to BKG licensing. They are licensed under the German Open Data license dl-de/by-2-0 and can be used both commercially and non-commercially with attribution.

When incorporating BKG geodata, please include the following attribution. Update the year to match your data acquisition data and keep the links intact.

This is a summary based on the BKG copyright notice

Disclaimer

This package is an independent project and is not affiliated with, endorsed by, or officially connected to the Federal Agency for Cartography and Geodesy (Bundesamt für Kartographie und Geodäsie, BKG) in any way. All references to data, services, or resources provided by the BKG are for informational purposes only.

Metadata

Version

0.1.2

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows