Skip to contents

Get centerlines for OSM road network

Usage

osm_centerlines(
  bbox = NULL,
  place = NULL,
  osm_file = NULL,
  use_buildings = TRUE,
  venv = NA
)

Arguments

bbox

bbox (Optional, if place provided). Area from which to export bus lanes.

place

String (Optional, if bbox provided). Place from which to export bus lanes.

osm_file

String (Optional). Path to a local OpenStreetMap PBF file (`.pbf`).

use_buildings

Boolean (Default TRUE). Uses buildings from OSM as exclusion_mask for neatnet.

venv

String (Default creates a new one). Python environment where neatnet will run.

Value

sf data.frame. OSM centerlines.

Details

Exports road network from OpenStreetMap for given area and uses Python neatnet package to compute its centerlines.

One of bbox, place, or osm_file must be provided.

Parameter use_buildings exports building footprints from OSM for better results on the network simplification process.

This method was adapted from uscuni.org/neatnet by Miguel Relvas Pires in the scope of his master's thesis. The full code (Python) of his work is openly available at GitHub.

Examples

if (FALSE) { # \dontrun{
# Get sample OSM extract
osm_file <- system.file("extdata/samples", "relation_6384187.pbf", package = "GTFShift")

network <- GTFShift::osm_centerlines(
  place = "Arroios, Lisboa, Portugal",
  osm_file = osm_file
)

head(network)

table(network$X_status)
} # }