Description Usage Arguments Details Value Note
Build a routable graph from a set of linestrings
1 | build_streetnet(x, protect = NULL)
|
x |
An object of class |
protect |
Set of points that protect their nearest linestring vertex
from being smoothed (see Details). That is, the closest linestring vertices
to these points are guaranteed to be a node in the resulting graph, even if
they are neither a pendant node nor a junction node. May be given either as
an object of class |
Graph building is implemented as a step-wise process. The graph
will be directed, so first all linestring geometries of x
that are not
marked as being a oneway street (through the oneway attribute column if
present) are duplicated and reversed. Then, all the linestring geometries
are split such that their segments become separate linestring geometries
on their own. These serve as the edges in the initial graph, and their
endpoints become the nodes. Endpoints that are shared between multiple edges
become a single node, such that these edges are connected. Only the largest
connected component of the initial graph is preserved. Finally, the initial
graph is smoothed by removing all nodes that are neither a pendant node
(i.e. a node at the end of an edge without a connection to any other edge)
nor a junction node (i.e. a node that connects more than two edges) nor a
nearest node to any of the points passed to the protect
parameter.
An object of class sfnetwork
.
Coordinates should be expressed in coordinate reference system EPSG:4326. The function assumes this to be true, and does not check for it.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.