Skip to contents

The dodgr package is designed for routing on directed graphs, and is known for its fast computations of cost matrices, shortest paths, and more. In sfnetwork, dodgr can be chosen as a routing backend.

Usage

dodgr_to_sfnetwork(x, edges_as_lines = TRUE)

sfnetwork_to_dodgr(x, weights = edge_length(), time = FALSE)

Arguments

x

For the conversion to sfnetwork: an object of class dodgr_streetnet. For the conversion from sfnetwork: an object of class sfnetwork.

edges_as_lines

Should the created edges be spatially explicit, i.e. have LINESTRING geometries stored in a geometry list column? Defaults to TRUE.

weights

The edge weights to be stored in the dodgr streetnet. Evaluated by evaluate_weight_spec. The default is edge_length, which computes the geographic lengths of the edges. Dual-weights can be provided through dual_weights.

time

Are the provided weights time values? If TRUE, they will be stored in a column named 'time' rather than 'd'. Defaults to FALSE.

Value

For the conversion to sfnetwork: An object of class sfnetwork. For the conversion from sfnetwork: an object of class dodgr_streetnet.

Note

The dodgr package is designed for directed graphs. If the provided sfnetwork object is undirected, it is made directed by duplicating and reversing each edge.