Learn R Programming

sfnetworks (version 0.3.1)

spatial_morphers: Spatial morphers for sfnetwork objects

Description

These functions are meant to be passed into [morph()] to create a temporary alternate representation of the input graph. They are thus not meant to be called directly. See below for detail of each morpher. For a more detailed explanations on how to use morphing, see morph.

Usage

to_spatial_coordinates(graph)

to_spatial_dense_graph(graph)

to_spatial_directed(graph)

to_spatial_explicit_edges(graph)

to_spatial_implicit_edges(graph)

to_spatial_shortest_paths(graph, ...)

to_spatial_subgraph(graph, ..., subset_by = NULL)

Arguments

graph

An object of class sfnetwork.

...

Arguments to be passed on to other function. See the description of each morpher for details.

subset_by

Whether to create subgraphs based on nodes or edges.

Value

A list of sfnetwork objects.

Functions

  • to_spatial_coordinates: Store the spatial coordinates of the nodes in separate coordinate columns (e.g. "X" and "Y"), instead of an sfc geometry list column. If edges are spatially explicit, the edge geometries are dropped.

  • to_spatial_dense_graph: Reconstruct the network by using all edge linestring points as nodes, instead of only the endpoints.

  • to_spatial_directed: Make a graph directed in the direction given by the linestring geometries of the edges.

  • to_spatial_explicit_edges: Draw linestring geometries for spatially implicit edges.

  • to_spatial_implicit_edges: Remove linestring geometries of spatially explicit edges.

  • to_spatial_shortest_paths: Limit a graph to those nodes and edges that are part of the shortest path between two nodes. If multiple to nodes are given, multiple shortest paths are returned. ... is evaluated in the same manner as st_shortest_paths, except that the output, predecessors and inbound.edges arguments are ignored. When unmorphing only the first instance of both the node and edge data will be used, as the the same node and/or edge can be present in multiple paths.

  • to_spatial_subgraph: Limit a graph to a single spatial subset. ... is evaluated in the same manner as st_filter.