Is your feature request related to a problem? Please describe.
Right now, if you provide an sf objects as nodes, but a regular data frame with a to and from column as edges, the sfnetwork construction function simply creates the network with those two objects, and does not create linestrings for the edges. This is probably good for some use-cases, but in other use-cases, it might be nicer if the construction function would already create the spatially explicit edges, instead of the user having to do this himself in either pre or post processing.
Describe the solution you'd like
An option edges_as_lines in the sfnetwork() construction function. If TRUE, the returned network will always be spatially explicit, no matter if you provided the edges as sf object or not. If FALSE, the edges will always be spatially implicit.
Is your feature request related to a problem? Please describe. Right now, if you provide an
sf
objects as nodes, but a regular data frame with ato
andfrom
column as edges, thesfnetwork
construction function simply creates the network with those two objects, and does not create linestrings for the edges. This is probably good for some use-cases, but in other use-cases, it might be nicer if the construction function would already create the spatially explicit edges, instead of the user having to do this himself in either pre or post processing.Describe the solution you'd like An option
edges_as_lines
in thesfnetwork()
construction function. IfTRUE
, the returned network will always be spatially explicit, no matter if you provided the edges assf
object or not. IfFALSE
, the edges will always be spatially implicit.