Determines road classification defined by Chan and Cooper's work. Specifically re-classifies roads as one of 8 road classes (0-7) specified in the following table, depending on each features highway= key values.

recode_road_class(osm_sf)

Arguments

osm_sf
  • A sf and data.frame object containing OpenStreetMap infrastructure data, obtained from the osmextract function.

Value

The osm_sf simple features data frame is returned with additional columns road_class and road_desc based on Chan and Cooper's road classifications.

Details

Re-classifies data based on the following highway key values:

Road ClassDescriptionSelection from OSM
7Motorwayshighway = motorway OR highway = motorway_link
6Non-residential Dual Carriagewayshighway =  trunk OR highway = trunk_link*manual classification needed
5Residential Dual Carriagewayshighway =  trunk OR highway =  trunk_link*manual classification needed
4Primary Roadshighway =  primary OR highway =  primary_link OR (highway =  trunk AND oneway = F)
3Secondary Roadshighway =  secondary OR highway =  secondary_link
2Tertiary Roadshighway = tertiary OR highway = tertiary_link
1Local Roadshighway = living_street OR highway = residential OR highway = unclassified
0Traffic-free Pathshighway = cycleway

Examples

library(sf)
u_data_large = paste0("https://github.com/udsleeds/openinfra/releases",
                      "/download/v0.2/bbbike_leeds_27_6_22.geojson")
u_data_small = paste0("https://github.com/udsleeds/openinfra/releases",
                      "/download/v0.2/30_06_22_bbbike_LCC_func_example_5_75km.geojson")
internal_data = example_data
output = recode_road_class(internal_data)
# Quick plot:
 plot(output["road_desc"], key.pos = 1)


# Advanced plot with tmap - un-comment following four lines to run! 
# tmap_mode("view")
# tmap::tm_shape(output |> dplyr::select(road_desc)) +
#  tmap::tm_lines(col = "road_desc", title.col = "Road class") +
#  tmap::tm_layout(legend.bg.color = "white")