The structure of networks generated by this function is dependent
on many aspects of the input network, and in particular on specific
key-value pairs defined in the underlying OpenStreetMap (OSM) data.
Many key-value pairs influence the resultant network through being used in
specified weighting profiles. Keys used in weighting profiles are always
kept in the weighted networks, and are specified in
weighting_profiles by the "way" column in the "weighting_profiles"
item. These include:
"bridleway"
"cycleway"
"ferry"
"footway"
"living_street"
"motorway"
"motorway_link
"path"
"pedestrian"
"primary"
"primary_link"
"residential"
"secondary"
"secondary_link
"service"
"steps"
"tertiary"
"tertiary_link"
"track"
"trunk"
"trunk_link
"unclassified"
Some of these are only optionally kept, dependent on the weighting profile
chosen. For example, "cycleway" keys are only kept for bicycle weighting.
Most of the specified keys also include all possible variations on those
keys. For the example of "cycleway" again, key-value pairs are also kept for
"cycleway:left" and "cycleway:right".
The following additional keys are also automatically retained in weighted
networks:
Realistic routing including factors such as access restrictions, turn
penalties, and effects of incline, can only be implemented when the objects
passed to weight_streetnet
are of sc ("silicate") format, generated
with dodgr_streetnet_sc (and possibly enhanced through applying the
osmdata function osm_elevation()
). Restrictions applied to ways (in
OSM terminology) may be controlled by ensuring specific columns are retained
in the dodgr
network with the keep_cols
argument. For example,
restrictions on access are generally specified by specifying a value for the
key of "access". Include "access" in keep_cols
will ensure these values
are retained in the dodgr
version, from which ways with specified values
can easily be removed or modified, as demonstrated in the examples.
Restrictions and time-penalties on turns can be implemented by setting
turn_penalty = TRUE
, which will then honour turn restrictions specified in
OSM (unless the "penalties" table of weighting_profiles has
restrictions = FALSE
for a specified wt_profile
). Resultant graphs are
fundamentally different from the default for distance-based routing. These
graphs may be used directly in most 'dodgr' functions, but generally only if
they have been created by calling this function in the same session, or if
they have been saved and loaded with the dodgr_save_streetnet and
dodgr_load_streetnet functions. (This is because the weighted
streetnets also have accompanying data stored in a local temporary cache
directory; attempting to pass a weighted street network without these
accompanying cache files will generally error.)
Some key-value pairs may also directly influence not just the value of the
graph produced by this function, but also its size. Among these are "oneway"
flags. Without these flags, each edge will be represented in directed form,
and so as two rows of the graph: one for A -> B, and one for B -> A. If a
way is tagged in OSM as "oneway" = "yes", and if oneway flags are respected
for a chosen weighting profile (which, for example, they are generally not
for pedestrian or "foot" weighting), then only one edge will be returned
representing travel in the direction permitted within the OSM data. Thus
weighting a network which includes "oneway" flags, and using a weighting
profile which respects these, will generate a graph with fewer rows than a
graph produced by ignoring those "oneway" flags.