R/sf.R
graph_to_sf.RdThis expects graph to have a lat and lon vertex attribute, however you
may pass in alternate numeric vectors to v_lat and v_lon.
graph_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"), v_lon = igraph::vertex_attr(graph, "lon")) edges_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"), v_lon = igraph::vertex_attr(graph, "lon")) nodes_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"), v_lon = igraph::vertex_attr(graph, "lon"))
| graph | An |
|---|---|
| v_lat | Numeric. Latitude values for each vertex |
| v_lon | Numeric. Longitude values for each vertex |
A named list with an edges and a nodes sfc object.
edges_to_sf: Return only the edges as an st_linestring object
nodes_to_sf: Return only the nodes as an st_point object