Closed jsta closed 7 years ago
I see that line2network(foo)$sp
outputs a SpatialLinesDataFrame
but it doesn't include any of the associated attributes in the other rivernetwork
slots.
I got it with this sf
code.
library(riverdist)
library(sf)
filepath <- system.file("extdata", package="riverdist")
Gulk_UTM5 <- line2network(path=filepath, layer="Gulk_UTM5")
res_geom <- st_cast(st_sfc(st_multilinestring(Gulk_UTM5$lines)), "LINESTRING")
res <- st_sf(Gulk_UTM5$lineID, geom = res_geom)
plot(res)
as(res, "Spatial")
class : SpatialLinesDataFrame features : 14 extent : 839774.3, 895654.8, 6922087, 7010276 (xmin, xmax, ymin, ymax) coord. ref. : NA variables : 3 names : rivID, sp_line, sp_seg min values : 1, 1, 1 max values : 14, 1, 14
It would be great if you could make the round trip between
SpatialLinesDataFrame
andrivernetwork
objects with anetwork2line
function.One thing that would be possible as a result is network QA with the mapview and mapedit packages.