Gets junction points from route networks, building on functions in the stplanr package: https://github.com/ropensci/stplanr/blob/master/R/rnet-clean.R

osm_get_junctions(x, method = "stplanr", overline = FALSE)

Arguments

x

a SF data frame of OSM linestrings

method

which method to use? The default, "stplanr" uses the rnet_breakup_vertices() function in the stplanr package. An alternative method, "duplicated", is simpler but returns junctions on straight road sections, e.g. where a road name changes.

overline

should the route network be pre-processed with the overline function?

Value

Returns an SF data frame of POINTS

Details

This function finds all junction points in a road network, i.e. where two roads meet. It excludes road crossings e.g. bridges.

See also

Examples

x = osm_main_roads(tc_data_osm)
class(x$geometry)
#> [1] "sfc_LINESTRING" "sfc"           
junctions = osm_get_junctions(x)
boundary_points = stplanr::rnet_get_nodes(x)
summary(duplicated(boundary_points))
#>    Mode   FALSE 
#> logical     125 
junctions2 = osm_get_junctions(x, method = "duplicates")
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
length(junctions)
#> [1] 50
length(junctions2)
#> [1] 107
plot(x$geometry, col = "grey")
plot(junctions, add = TRUE)
plot(junctions2, add = TRUE, col = "red", cex = 0.5)