Skip to contents

This function downloads OpenStreetMap highway data within the specified bounding box. It corrects the geometries of reversed one-way roads. Optionally, it crops the data to the bounding box.

Usage

fetch_roads(bbox, crop = TRUE)

Arguments

bbox

A bounding box in the form of a matrix with two rows and two columns.

crop

A logical value indicating whether to crop the data to the bounding box. Defaults to TRUE.

Value

A data frame containing OpenStreetMap road data.

Examples

if (FALSE) { # \dontrun{
# Download road data
bbox <- create_bbox(
  north =  35.17377,
  south =  35.16377,
  east  = 136.91590,
  west  = 136.90090
)
roads <- fetch_roads(bbox)

# Plot the roads
plot(roads$geometry)
} # }