build_graph_cppr {spNetwork}R Documentation

Network generation with cppRouting

Description

Generate an cppRouting object from a feature collection of linestrings

Usage

build_graph_cppr(lines, digits, line_weight, attrs = FALSE, direction = NULL)

Arguments

lines

A feature collection of lines

digits

The number of digits to keep from the coordinates

line_weight

The name of the column giving the weight of the lines

attrs

A boolean indicating if the original lines' attributes should be stored in the final object

Details

This function can be used to generate an undirected graph object (cppRouting object). It uses the coordinates of the linestrings extremities to create the nodes of the graph. This is why the number of digits in the coordinates is important. Too high precision (high number of digits) might break some connections.

Value

A list containing the following elements:

Examples


data(mtl_network)
mtl_network$length <- as.numeric(sf::st_length(mtl_network))
graph_result <- build_graph_cppr(mtl_network, 2, "length", attrs = TRUE)


[Package spNetwork version 0.4.4.6 Index]