tidygraph_methods | R Documentation |
Normally tidygraph functions should work out of the box on
sfnetwork
objects, but in some cases special treatment is
needed especially for the geometry column, requiring a specific method.
## S3 method for class 'sfnetwork'
as_tbl_graph(x, ...)
## S3 method for class 'sfnetwork'
reroute(.data, ...)
## S3 method for class 'sfnetwork'
morph(.data, ...)
## S3 method for class 'morphed_sfnetwork'
unmorph(.data, ...)
x |
An object of class |
... |
Arguments passed on the corresponding |
.data |
An object of class |
See the tidygraph
documentation. The
following methods have a special behavior:
reroute
: To preserve the valid spatial network structure,
this method will replace the boundaries of edge geometries by the location
of the node those edges are rerouted to or from. Note that when the goal
is to reverse edges in a spatial network, reroute will not simply reverse
the edge geometries. In that case it is recommended to use the sfnetwork
method for st_reverse
instead.
morph
: This method checks if the morphed network still has
spatially embedded nodes. In that case a morphed_sfnetwork
is
returned. If not, a morphed_tbl_graph
is returned instead.
unmorph
: This method makes sure the geometry list column is
correctly handled during the unmorphing process.
The method for as_tbl_graph
returns an
object of class tbl_graph
. The method for
morph
returns a morphed_sfnetwork
if the
morphed network is still spatial, and a morphed_tbl_graph
otherwise.
All other methods return an object of class sfnetwork
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.