| linestrings_to_graph | R Documentation |
Convert Linestring to Graph
linestrings_to_graph(
lines,
digits = 6,
keep.cols = is.atomic,
compute.length = TRUE
)
lines |
An sf data frame of LINESTRING geometries. |
digits |
Numeric rounding applied to coordinates (to ensure that matching points across different linestrings is not impaired by numeric precision issues). Set to |
keep.cols |
Character vector of column names to keep from the input data frame. |
compute.length |
Applies |
A data.frame representing the graph with columns:
edge - Edge identifier
from - Starting node ID
FX - Starting node X-coordinate (longitude)
FY - Starting node Y-coordinate (latitude)
to - Ending node ID
TX - Ending node X-coordinate (longitude)
TY - Ending node Y-coordinate (latitude)
simplify_network flownet-package
library(flownet)
library(sf)
# Load existing network edges (exclude proposed new links)
africa_net <- africa_network[!africa_network$add, ]
# Convert network LINESTRING geometries to graph
graph <- linestrings_to_graph(africa_net)
head(graph)
# Graph contains edge, from/to nodes, and coordinates
names(graph)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.