| oe_get_network | R Documentation |
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.
oe_get_network(place, mode = c("cycling", "driving", "walking"), ...)
place |
Description of the geographical area that should be matched with
a |
mode |
A character string of length one denoting the desired mode of
transport. Can be abbreviated. Currently |
... |
Additional arguments passed to |
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 highway tag is not missing;
The highway tag is not equal to abandoned, bus_guideway, byway,
construction, corridor, elevator, fixme, escalator, gallop,
historic, no, planned, platform, proposed, raceway or
steps;
The highway tag is not equal to motorway, motorway_link,
footway, bridleway or pedestrian unless the tag bicycle is equal
to yes, designated, permissive or destination (see
here
for more details);
The access tag is not equal to private or no unless bicycle is
equal to yes, permissive or designated (see #289);
The bicycle tag is not equal to no, use_sidepath, private, or
restricted;
The service tag does not contain the string private (i.e.
private, private_access and similar);
The walking mode of transport selects the OSM ways that meet the
following conditions:
The highway tag is not missing;
The highway tag is not equal to abandoned, bus_guideway,
byway, construction, corridor, elevator, fixme,
escalator, gallop, historic, no, planned, platform, proposed,
raceway, motorway or motorway_link;
The highway tag is not equal to cycleway unless the foot tag is
equal to yes;
The access tag is not equal to private or no unless foot is
equal to yes, permissive, or designated (see #289);
The foot tag is not equal to no, use_sidepath, private, or
restricted;
The service tag does not contain the string private
(i.e. private, private_access and similar).
The driving mode of transport selects the OSM ways that meet the
following conditions:
The highway tag is not missing;
The highway tag is not equal to abandoned,
bus_guideway, byway, construction, corridor, elevator, fixme,
escalator, gallop, historic, no, planned, platform, proposed,
cycleway, pedestrian, bridleway, path, or footway;
The access tag is not equal to private or no unless motor_vehicle is
equal to yes, permissive, or designated (see #289);
The service tag does not contain the string private (i.e. private,
private_access and similar).
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.
Starting from version 0.5.2, the version argument (see oe_get()) can be
used to download historical OSM extracts from Geofabrik provider.
An sf object.
oe_get()
# 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())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.