Skip to contents

This function downloads and patches the tiled digital elevation models (dem) along the German federal waterways Elbe and Rhine that have been published on


getDEM(filename = "", ext, crs, ...)



supplies an optional in- and output filename and has to be type character.


argument of type SpatExtent.


argument of type crs or crs. It is used to select the respective river (Elbe: 'ETRS 1989 UTM 33N'; Rhine: 'ETRS 1989 UTM 32N')


additional arguments as for writeRaster.


SpatRaster object containing elevation data for the selected floodplain region.


Since the underlying tiled digital elevation models (dem) are rather large datasets hydflood provides options to permanentely cache these datasets. options("hydflood.datadir" = tempdir()) is the default. To modify the location of your raster cache to your needs set the respective options() prior to loading the package, e.g. options("hydflood.datadir" = "~/.hydflood");library(hydflood). The location can also be determined through the environmental variable hydflood_datadir.

Since downloads of large individual datasets might cause timeouts, it is recommended to increase options("timeout").


Weber A (2020). “Digital elevation models of German waterway and navigation authorities - Version 0.1.0.”

Weber A (2020). “Digital elevation model (DEM1) of the River Elbe floodplain between Schmilka and Geesthacht, Germany.”

Weber A (2020). “Digital elevation model (DEM1) of the River Rhine floodplain between Iffezheim and Kleve, Germany.”


# \donttest{
  options("hydflood.datadir" = tempdir())
  options("timeout" = 120)
  dem <- getDEM(ext = ext(c(309000, 310000, 5749000, 5750000)),
                crs = st_crs("EPSG:25833"))
# }