The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Fetching OSM roads

Overview

fetch_osm_roads() provides a lightweight wrapper around osmdata that returns a road-line sf object you can pass directly into the rest of the trafficCAR workflow. It accepts either a place name (geocoded to a bounding box) or explicit bounding-box coordinates. Note that fetch_osm_roads() requires the osmdata package.

Fetch by place name

library(trafficCAR)

# Query a place name (uses osmdata::getbb() under the hood)
roads_sf <- fetch_osm_roads("College Station, TX")

segments <- roads_to_segments(roads_sf)
net <- build_network(segments)

Fetch by bounding box

library(trafficCAR)

# xmin, ymin, xmax, ymax
bbox <- c(-96.38, 30.59, -96.33, 30.63)
roads_sf <- fetch_osm_roads(bbox)

segments <- roads_to_segments(roads_sf)
net <- build_network(segments)

Filtering the OSM query

You can refine the query by passing highway values or additional tags.

roads_sf <- fetch_osm_roads(
  "College Station, TX",
  value = c("primary", "secondary"),
  extra_tags = list(surface = "asphalt")
)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.