Skip to contents

In this notebook we download OpenStreetMap (OSM) data needed for the delineation of the urban river corridor of River Dâmbovița in Bucharest, Romania. After attaching the packages used in the vignette, we specify the city name, the river name, and the CRS, and we make sure that we provide a buffer around the river used to retrieve OSM data.

library(rcrisp)
library(purrr)

city_name <- "Bucharest"
river_name <- "Dâmbovița"
crs <- 32635  # EPSG code for UTM zone 35N, where Bucharest is located
buffer <- 3000  # in m, expand bbox for street network

We start by getting the bounding box for the study area:

bb <- get_osm_bb(city_name)

Using the obtained bounding box, we get the different layers of OSM data needed for the delineation of the urban river corridor. We will get the city boundary, the waterways, the street network, and the rail network using built-in functions from the rcrisp package.

river <- get_osm_river(bb, river_name, crs)
aoi_network <- get_river_aoi(river, bb, buffer_distance = buffer)
streets <- get_osm_streets(bb, crs)
railways <- get_osm_railways(bb, crs)
city_boundary <- get_osm_city_boundary(bb, city_name, crs)

bucharest_osm <- list(
  bb = bb,
  river_centerline = river$centerline,
  river_surface = river$surface,
  aoi_network = aoi_network,
  streets = streets,
  railways = railways,
  boundary = city_boundary
)

The above layers can also be obtained with the all-in-one function get_osmdata(). Optionally, a buffer around the river can be specified for the retrieval of OSM data.

bucharest_osm <- get_osmdata(city_name, river_name, network_buffer = buffer)

The resulting object is a list with all the layers obtained above.

names(bucharest_osm)
#> [1] "bb"               "river_centerline" "river_surface"    "aoi_network"     
#> [5] "streets"          "railways"         "boundary"
All layers combined

All layers combined

Individual layers can be written to disk before being read in for delineation.

walk2(
  bucharest_osm,
  names(bucharest_osm),
  ~ st_write(
    .x,
    dsn = sprintf("%s_%s.gpkg", .y, city_name),
    append = FALSE,
    quiet = TRUE
  )
)