The clean re-coded speeds are stored in openinfra_maxspeed.

oi_clean_maxspeed_uk(osm_sf, no_NA = FALSE, del = FALSE)

Arguments

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

no_NA
  • Boolean, FALSE by default. If TRUE then any oi_maxspeed == NA are removed. (i.e. maxspeed value is NOT compliant with UK speed limits) are removed from osm_sf.

del
  • Boolean, FALSE by default. If TRUE then the original maxspeed column is deleted and only openinfra_maxspeed is returned.

Value

The osm_sf simple features data frame is returned with the maxspeed column values cleaned based on allowed_speeds.

Details

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

Examples

library(sf)
internal_data = example_data
output = oi_clean_maxspeed_uk(internal_data, no_NA = TRUE)
plot(output["openinfra_maxspeed"])

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