# NOT RUN {
library(sf)
par(mar = rep(0, 4))
# Check for roundabout
plot(rnet_roundabout$geometry, lwd = 2, col = rainbow(nrow(rnet_roundabout)))
rnet_roundabout_clean <- rnet_breakup_vertices(rnet_roundabout)
plot(rnet_roundabout_clean$geometry, lwd = 2, col = rainbow(nrow(rnet_roundabout_clean)))
# Check for overpasses
plot(rnet_overpass$geometry, lwd = 2, col = rainbow(nrow(rnet_overpass)))
rnet_overpass_clean <- rnet_breakup_vertices(rnet_overpass)
plot(rnet_overpass_clean$geometry, lwd = 2, col = rainbow(nrow(rnet_overpass_clean)))
# }
# NOT RUN {
# mapview(rnet_overpass_clean)
# }
# NOT RUN {
# Check for intersection with no node
plot(rnet_cycleway_intersection$geometry, lwd = 2,
col = rainbow(nrow(rnet_cycleway_intersection)))
rnet_cycleway_intersection_clean <- rnet_breakup_vertices(rnet_cycleway_intersection)
plot(rnet_cycleway_intersection_clean$geometry,
lwd = 2, col = rainbow(nrow(rnet_cycleway_intersection_clean)))
# Bigger example
# }
# NOT RUN {
u <- "https://download.geofabrik.de/europe/great-britain/england/isle-of-wight-latest.osm.pbf"
iow <- sf::st_read(u)
key_roads_text = "primary|secondary|tertiary|cycleway|trunk|motorway"
iow_small <- iow[grepl(pattern = key_roads_text, x = iow$highway), ]
system.time(iow_clean <- rnet_breakup_vertices(iow_small))
# Should be quite faster than the old version we could always profile it.
plot(iow_small$geometry)
plot(iow_clean$geometry)
# }
Run the code above in your browser using DataLab