The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

2. Getting OSM data for delineation

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 rcrisp 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_osm <- list(
  bb = bb,
  boundary = city_boundary,
  river_centerline = river$centerline,
  river_surface = river$surface,
  streets = streets,
  railways = railways
)

walk2(
  bucharest_osm,
  names(bucharest_osm),
  ~ st_write(
    .x,
    dsn = sprintf("%s_%s.gpkg", .y, 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_osm <- get_osmdata(city_name, river_name, buffer = bbox_buffer)

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

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

All layers combined

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.