Function to recategorise OSM data, combining both the name & ref field for an OSM feature, or whichever is available.

oi_road_names(osm_sf, remove=FALSE)

Arguments

osm_sf
  • A Simple Features sf and data.frame object containing OpenStreetMap infrastructure data.

remove
  • If TRUE, will remove all features that still have a NA for openinfra_road_name column (removes nameless features).

Value

an sf object with openinfra_road_name column added, indicating the name and ref fields of the feature, if they are included.

Details

This function analyses OSM features, specifically the name and ref fields that contain a road name (i.e. Otley Road) and the road reference field (i.e A62). If both the name and ref appear, then openinfra_road_name will be name | ref, otherwise openinfra_road_name will be whichever field appears within the OSM data.

Note: the osm_sf must contain the following tags: c("name", "ref")

Examples

data = example_data
data = data %>% dplyr::mutate(ref = "ref_field")
example_output = oi_road_names(data)