River space delineation is a delineation step that uses the river and buildings as input to generate a polygon representing the space between the river and the first line of buildings. We will use Bucharest as the study area and the River Dâmbovița as the river.
city_name <- "Bucharest, Romania" # Be specific and spell as in OSM
river_name <- "Dâmbovița" # Spell as it appears in OSM
epsg_code <- 32635 # UTM zone 35N
bbox_buffer <- 2000 # Buffer around the city boundary in meters
# Get the bounding box from the Nominatim API provided by OSM.
bb <- getbb(city_name)
aoi <- define_aoi(bb, epsg_code, bbox_buffer)
city_boundary <- osmdata_as_sf("place", "city", bb)$osm_multipolygons |>
st_transform(epsg_code) |>
st_geometry()
river_centerline <- osmdata_as_sf("waterway", "river", bb)$osm_multilines |>
filter(name == river_name) |>
st_transform(epsg_code) |>
st_geometry() |>
st_intersection(st_buffer(aoi, bbox_buffer))
river_surface <- osmdata_as_sf("natural", "water", bb)
river_surface <- river_surface$osm_multipolygons |>
bind_rows(river_surface$osm_polygons) |>
st_transform(epsg_code) |>
st_filter(river_centerline, .predicate = st_intersects) |>
st_geometry() |>
st_union()
buildings <- osmdata_as_sf("building", "yes", bb)$osm_multipolygons |>
st_transform(epsg_code) |>
st_geometry()
The delineate_riverspace()
function takes the city
boundary, river surface and building polygons as input. If no river is
found, it will return an error message. If buildings are not found, it
will return an unobstructed buffer of a given radius with a warning
message. By default, the river space will be capped by the city
boundaries. The function returns an sf polygon.
riverspace <- delineate_riverspace(city_boundary, river_surface, buildings)