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.

oi_recode_road_class(osm_sf, del=FALSE)

Arguments

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

del
  • If TRUE, will remove roads not recategorised by the function into one of the pre-set definitions.

Value

The osm_sf simple features data frame is returned with additional columns openinfra_road_class and openinfra_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

Note: the osm_sf must contain the following tags: c("highway", "oneway")

Examples

library(sf)
internal_data = example_data
output = oi_recode_road_class(internal_data, del = FALSE)
# Quick plot:
 plot(output["openinfra_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(openinfra_road_desc)) +
#  tmap::tm_lines(col = "openinfra_road_desc", title.col = "Road class") +
#  tmap::tm_layout(legend.bg.color = "white")