This function makes invalid edges valid by modifying either edge or node geometries such that the boundary points of edge linestring geometries always match the point geometries of the nodes that are specified as their incident nodes by the *from* and *to* columns.
Arguments
- x
An object of class
sfnetwork
.- preserve_geometries
Should the edge geometries remain unmodified? Defaults to
FALSE
. See Details.
Value
An object of class sfnetwork
with corrected edge
geometries.
Details
If geometries should be preserved, edges are made valid by adding
edge boundary points that do not equal their corresponding node geometry as
new nodes to the network, and updating the *from* and *to* indices to match
this newly added nodes. If FALSE
, edges are made valid by modifying
their geometries, i.e. edge boundary points that do not equal their
corresponding node geometry are replaced by that node geometry.
Note
This function works only if the edge geometries are meant to start at
their specified *from* node and end at their specified *to* node. In
undirected networks this is not necessarily the case, since edge geometries
are allowed to start at their specified *to* node and end at their specified
*from* node. Therefore, in undirected networks those edges first have to be
reversed before running this function. Use
make_edges_follow_indices
for this.