Description Usage Arguments Details Value See Also Examples
View source: R/osm_cleaning_functions.R
Consolidate roads into simplified network
1 | osm_consolidate(x, segment = 500)
|
x |
a SF data frame of OSM linestrings with projected CRS |
segment |
numeric, max length of segments in metres |
This function simplifies a OSM road network by: 1) grouping small
road segments into single names roads 2) splitting long roads into sections
are defined by segment
3) Casting MULTILINESTRINGs into LINESTRING
Note: to avoid splitting short roads, roads are only split once they are 2x
segment
, but are then splits into lengths as defined by segment
. For
example a 600m road will not be split, but a 1100m road will be split into
approximately 500m segments when segment = 500
.
Returns an data frame of LINESTRINGS
Other OSM:
cluster_junction()
,
line_segment_sf()
,
nn_line()
,
nn_point()
,
osm_get_junctions()
,
osm_main_roads()
1 2 3 4 5 6 7 8 9 10 11 12 | library(sf)
osm = osm_main_roads(tc_data_osm)
x = sf::st_transform(osm, 27700)
osm_consolidated_200m = osm_consolidate(x, segment = 200)
nrow(x)
nrow(osm_consolidated_200m) / nrow(x) # fewer lines
table(x$name)
table(osm_consolidated_200m$name)
plot(x$geometry, col = 1:nrow(x))
plot(osm_consolidated_200m$geometry, col = 1:nrow(osm_consolidated_200m))
summary(sf::st_length(x))
summary(sf::st_length(osm_consolidated_200m))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.