| ox_consolidate_intersections | R Documentation |
Merges groups of nodes lying within tolerance of one another into single
nodes placed at the group centroid, then rewrites edges to the consolidated
nodes and drops the resulting self-loops. Useful for collapsing the multiple
OSM nodes that represent one complex junction (e.g. dual carriageways).
ox_consolidate_intersections(g, tolerance = 10)
g |
An osm_graph. |
tolerance |
Distance below which nodes are merged, in CRS units.
Default |
Clustering uses sf::st_is_within_distance(); connected components are found
by the Rust core. tolerance is in the units of the graph CRS, so project
the graph first (e.g. to a metric CRS) for a meaningful distance.
A consolidated osm_graph (with meta$consolidated = TRUE).
g <- example_osm_graph(n = 4, spacing = 100)
# nothing is within 10 units here, so the graph is unchanged
ox_consolidate_intersections(g, tolerance = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.