Skip to contents

In this notebook we download OSM data needed for the delineation of the urban river corridor of River Dâmbovița in Bucharest, Romania. We make sure that we include a given area around the city boundaries.

city_name <- "Bucharest"
river_name <- "Dâmbovița"
crs <- 32635  # EPSG code for UTM zone 35N
bbox_buffer <- 2000  # 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 CRiSp package.

city_boundary <- get_osm_city_boundary(city_name, bb, crs)
river <- get_osm_river(river_name, bb, crs)
streets <- get_osm_streets(bb, crs)
railways <- get_osm_railways(bb, crs)

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

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

walk(
  st_write_list,
  ~ st_write(
    .x,
    dsn = sprintf("%s_%s.gpkg",
                  names(st_write_list)[map_lgl(st_write_list, identical, .x)],
                  city_name),
    append = FALSE,
    quiet = TRUE
  )
)

The above layers can also be obtained with the all-in-one function get_osmdata(). Optionally, a bounding box buffer can be specified to expand the bounding box.

bucharest <- get_osmdata(city_name, river_name, buffer = bbox_buffer)

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

names(bucharest)
if (requireNamespace("ggplot2", quietly = TRUE)) {
  library(ggplot2)
  ggplot() +
    geom_sf(data = bucharest$boundary, fill = "grey", color = "black") +
    geom_sf(data = bucharest$railways, color = "orange") +
    geom_sf(data = bucharest$streets, color = "black") +
    geom_sf(data = bucharest$river_surface, fill = "blue", color = "blue") +
    geom_sf(data = bucharest$river_centerline, color = "blue") +
    xlim(417000, 439000) +
    ylim(4908800, 4932500)
} else {
  message("ggplot2 not available; skipping plot examples.")
}
All layers combined

All layers combined