Skip to contents

Download and process OpenStreetMap (OSM) road lines within a specified geographical place, from the Geofabrik database. It is a wrapper around functions in the package osmextract, and processes the downloaded files for subsequent analyses. Refer to package osmextract for more details and options for input arguments when downloading the data.

Usage

get_roads_osm(
  place,
  date = NULL,
  dir_raw = osmextract::oe_download_directory(),
  filename = NULL,
  ...
)

Arguments

place

sf object (with projected coordinate reference system). Geographical area to match with the (.osm.pbf) file in the data archive. Argument passed to osmextract::oe_match().

date

Date of OSM data snapshot to download. Refer to https://download.geofabrik.de for the specific dates available. Defaults to NULL (download the latest available data).

dir_raw

character. Directory to download the raw unprocessed OSM data. Passed to argument download_directory in osmextract::oe_read().

filename

character (optional). File path to export output data (GeoJSON format).

...

Other arguments passed to osmextract::oe_read().

Value

The processed road lines (sf object).

Details

OSM lines are filtered by key-value attributes, where highway: is motorway, trunk, primary, secondary, tertiary, unclassified or residential, or their respective *_link values.