oe_get_network {osmextract}R Documentation

Import transport networks used by a specific mode of transport

Description

This function is a wrapper around oe_get() and can be used to import a road network given a place and a mode of transport. Check the Details for a precise description of the procedures used to filter the OSM ways according to each each mode of transport.

Usage

oe_get_network(place, mode = c("cycling", "driving", "walking"), ...)

Arguments

place

Description of the geographical area that should be matched with a .osm.pbf file. Can be either a length-1 character vector, an sf/sfc/bbox object, or a numeric vector of coordinates with length 2. In the last case, it is assumed that the EPSG code is 4326 specified as c(LON, LAT), while you can use any CRS with sf/sfc/bbox objects. See Details and Examples in oe_match().

mode

A character string of length one denoting the desired mode of transport. Can be abbreviated. Currently cycling (the default), driving and walking are supported.

...

Additional arguments passed to oe_get() such as boundary or force_download.

Details

The definition of usable transport network was taken from the Python packages osmnx and pyrosm and several other documents found online, i.e. https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions, https://wiki.openstreetmap.org/wiki/Key:access. See also the discussion in https://github.com/ropensci/osmextract/issues/153.

The cycling mode of transport (i.e. the default value for mode parameter) selects the OSM ways that meet the following conditions:

The walking mode of transport selects the OSM ways that meet the following conditions:

The driving mode of transport selects the OSM ways that meet the following conditions:

Feel free to create a new issue in the github repo if you want to suggest modifications to the current filters or propose new values for alternative modes of transport.

Value

An sf object.

See Also

oe_get()

Examples

# Copy the ITS file to tempdir() to make sure that the examples do not
# require internet connection. You can skip the next 4 lines (and start
# directly with oe_get_keys) when running the examples locally.

its_pbf = file.path(tempdir(), "test_its-example.osm.pbf")
file.copy(
  from = system.file("its-example.osm.pbf", package = "osmextract"),
  to = its_pbf,
  overwrite = TRUE
)

# default value returned by OSM
its = oe_get(
  "ITS Leeds", quiet = TRUE, download_directory = tempdir()
)
plot(its["highway"], lwd = 2, key.pos = 4, key.width = lcm(2.75))
# walking mode of transport
its_walking = oe_get_network(
  "ITS Leeds", mode = "walking",
  download_directory = tempdir(), quiet = TRUE
)
plot(its_walking["highway"], lwd = 2, key.pos = 4, key.width = lcm(2.75))
# driving mode of transport
its_driving = oe_get_network(
  "ITS Leeds", mode = "driving",
  download_directory = tempdir(), quiet = TRUE
)
plot(its_driving["highway"], lwd = 2, key.pos = 4, key.width = lcm(2.75))

# Remove .pbf and .gpkg files in tempdir
oe_clean(tempdir())

[Package osmextract version 0.5.1 Index]