Select the main roads from OSM

osm_main_roads(
  x,
  highway_values = c("primary", "primary_link", "secondary", "secondary_link",
    "tertiary", "tertiary_link", "trunk", "trunk_link", "motorway", "motorway_link",
    "unclassified", "residential", "road", "mini_roundabout")
)

Arguments

x

A data frame of OSM lines

highway_values

Which highway values to use to define 'main' roads? Default includes primary, secondar, trunk, motorway, residential and 'mini_roundabout' road values.

Value

Returns an data frame

Details

The OpenSteetMap contains a lot of detail, this function subsets the data to just the main roads used by cars by filtering on the highway tag.

See also

Examples

region_name = "Isle of Wight"
# osm = osmextract::oe_get(region_name) # test for IoW
# region_name = "Greater London" # test for London
osm = tc_data_osm
osm_main = osm_main_roads(osm)
nrow(osm)
#> [1] 499
nrow(osm_main)
#> [1] 125
nrow(osm_main) / nrow(osm) # keeps ~10-25% of lines
#> [1] 0.250501
plot(osm$geometry, col = "grey")
plot(osm_main$geometry, add = TRUE)