
Create a buffered road area inside an inundation or analysis zone
Source:R/tsunami_zones.R
make_roads_in_zone.RdMirrors the original script logic where roads were buffered, optionally buffered again for tolerance, cropped to the inundation zone, and then combined with the zone. This is useful for quality assurance and quality control and for reproducing the earlier road-plus-inundation analysis area.
Examples
r <- terra::rast(nrows = 4, ncols = 4, xmin = 0, xmax = 4, ymin = 0, ymax = 4,
vals = 1, crs = "EPSG:3857")
zone <- terra::as.polygons(r, dissolve = TRUE)
roads <- terra::vect(matrix(c(0, 2, 4, 2), ncol = 2, byrow = TRUE),
type = "lines", crs = "EPSG:3857")
make_roads_in_zone(roads, zone, road_buffer_m = 0.1)
#> class : SpatVector
#> geometry : polygons
#> dimensions : 1, 0 (geometries, attributes)
#> extent : 0, 4, 0, 4 (xmin, xmax, ymin, ymax)
#> coord. ref. : WGS 84 / Pseudo-Mercator (EPSG:3857)