Learn R Programming

trafficCAR (version 0.1.0)

fetch_osm_roads: Fetch road geometries from OpenStreetMap

Description

Convenience wrapper around `osmdata` to download road geometries and return an `sf` object that can be passed into `roads_to_segments()`.

Usage

fetch_osm_roads(
  place,
  key = "highway",
  value = NULL,
  extra_tags = NULL,
  layer = c("osm_lines", "osm_multilines", "osm_polygons", "osm_multipolygons"),
  quiet = TRUE,
  ...
)

Value

An `sf` object with road geometries.

Arguments

place

A character place name (passed to `osmdata::getbb()`) or a bounding box object accepted by `osmdata::opq()`.

key

OSM feature key to query. Default is `"highway"`.

value

Optional character vector of OSM feature values. For example, `c("primary", "secondary")`.

extra_tags

Optional named list of additional tags passed to `osmdata::add_osm_feature()`.

layer

Which OSM layer to return. Defaults to `"osm_lines"`.

quiet

Logical; suppress osmdata messages. Default TRUE.

...

Additional arguments passed to `osmdata::osmdata_sf()`.