Skip to contents

To initialize an object of class SpatRaster with layers dem and csa this function should be used. It checks all the required input data, downloads missing data automatically, clips and returns the final object, prepared for the flood() functions (flood1, flood2 and flood3).

Usage

hydSpatRaster(filename_dem = "", filename_csa = "", ext, crs, ...)

Arguments

filename_dem

an optional argument of length 1 with type character specifying a filename of a digital elevation model raster dataset.

If the file exists it is imported via rast and used to build the SpatRaster, potentially cropped by argument ext. If the dem file does not exist, data are downloaded automatically and exported using writeRaster and can be reused to accelerate later computations.

An existing dataset must be either in the coordinate reference system (crs) 'ETRS 1989 UTM 32N' (epsg: 25832) for the River Rhine or 'ETRS 1989 UTM 33N' (epsg: 25833) for the River Elbe. It must also overlap with the active floodplains (sf.afe or sf.afr) of the river selected through the crs.

If argument filename_csa is specified and exists too, the coordinate reference system (crs), extent (ext) and resolution (res) of both raster datasets must match.

Supported file types depend on available GDAL raster drivers.

filename_csa

an optional argument of length 1 with type character specifying a filename of a cross section area raster dataset.

If the file exists it is imported via rast and used to build the SpatRaster, potentially cropped by argument ext. If the csa file does not exist, data are downloaded automatically and exported using writeRaster and can be reused to accelerate later computations.

An existing dataset must be either in the coordinate reference system (crs) 'ETRS 1989 UTM 32N' (epsg: 25832) for the River Rhine or 'ETRS 1989 UTM 33N' (epsg: 25833) for the River Elbe. It must also overlap with the active floodplains (sf.afe or sf.afr) of the river selected through the crs and be in the possible range of station_int values: Elbe (m 0 - 585700), Rhine (m 336200 - 865700).

If argument filename_dem is specified too, coordinate reference system (crs), extent (ext) and resolution (res) of both raster datasets must match.

Supported file types depend on available GDAL raster drivers.

ext

optional argument of type SpatExtent. If neither filename_dem nor filename_csa are specified, ext is required to download the respective data and generate temporary dem and csa datasets. If either filename_dem or filename_csa or both are specified, ext must be within the extent of provided raster layers. Then it is used to crop the supplied data.

crs

optional argument of type crs or crs. If neither filename_dem nor filename_csa are specified, crs is used to select the respective river (Elbe: 'ETRS 1989 UTM 33N' (epsg: 25833); Rhine: 'ETRS 1989 UTM 32N' (epsg: 25832)) and crop downloaded dem and csa by the given ext. If either filename_dem or filename_csa or both are specified, crs must match their coordinate reference systems; otherwise an error is returned.

...

additional parameters passed to writeRaster.

Value

SpatRaster object containing digital elevation (dem) and cross section area (csa) raster layers.

Details

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").

References

Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV) (2016). “Digitales Geländemodell des Wasserlaufs (DGM-W).” https://www.govdata.de/daten/-/details/1c669080-c804-11e4-8731-1681e6b88ec1.

Brockmann H, Großkordt U, Schumann L (2008). “Auswertung digitaler Fernerkundungsaufnahmen des Elbe-Wasserlaufes (FE-Datenauswertung Elbe).”

Brockmann H, Schumann L (2012). “Produktblatt: DGM-W Elbe-Lenzen, 2003-2011.”

Brockmann H, Großkordt U, Schumann L (2008). “Digitales Geländemodell des Rhein-Wasserlaufes von Iffezheim bis Bonn (DGM-W Rhein).”

smile consult GmbH & Inphoris GmbH (2011). “DGM-W Oberrhein 1.”

FUGRO-HGN GmbH (2011). “Aufbau eines Digitalen Geländemodells des Oberrheinwasserverlaufes (DGM-W Oberrhein-2, Basel bis Iffezheim).”

ARGE Vermessung Schmid - Inphoris (2012). “Aufbau eines Digitalen Geländemodells des Niederrheinwasserlaufes (DGM-W Niederrhein).”

Weber A (2020). “Digital elevation models of German waterway and navigation authorities - Version 0.1.0.” https://doi.org/10.5675/BfG-2011.

Weber A (2020). “Digital elevation model (DEM1) of the River Elbe floodplain between Schmilka and Geesthacht, Germany.” https://doi.org/10.1594/PANGAEA.919293.

Weber A (2020). “Digital elevation model (DEM1) of the River Rhine floodplain between Iffezheim and Kleve, Germany.” https://doi.org/10.1594/PANGAEA.919308.

Bundesanstalt für Gewässerkunde (2016). “FLYS – Flusshydrologischer Webdienst.” http://www.bafg.de/DE/08_Ref/M2/03_Fliessgewmod/01_FLYS/flys_node.html.

Brunotte E, Dister E, Günther-Diringer D, Koenzen U, Mehl D (2009). “Zustand der rezenten Flussauen in Deutschland - Geodaten.”

Examples

# \donttest{
  options("hydflood.datadir" = tempdir())
  options("timeout" = 120)
  library(hydflood)
  
  e <- ext(436500, 438000, 5415000, 5416500)
  c <- st_crs("EPSG:25832")
  
  r <- hydSpatRaster(ext = e, crs = c)
  r
#> class       : SpatRaster 
#> dimensions  : 1500, 1500, 2  (nrow, ncol, nlyr)
#> resolution  : 1, 1  (x, y)
#> extent      : 436500, 438000, 5415000, 5416500  (xmin, xmax, ymin, ymax)
#> coord. ref. : ETRS89 / UTM zone 32N (EPSG:25832) 
#> source(s)   : memory
#> names       :     dem,    csa 
#> min values  : 104.424, 339990 
#> max values  : 122.517, 342115 
# }