You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to handle sf geometry collections in a way that preserves all the data? Or if not it would be great if there was a warning that data is being lost.
When I tried to convert an sf object with geometry type "GEOMETRYCOLLECTION" that contains points and lines to a SpatVector it appeared to work but the result only contained the lines.
It would be great if vect could detect that it was a "GEOMETRYCOLLECTION" and either produce a warning or maybe iterate over geometry types and then produce a SpatVectorCollection.
library(terra)
library(sf)
geom_col<- c(st_geometrycollection(list(st_point(1:2), st_linestring(matrix(1:6,3)))),
st_geometrycollection(list(st_multilinestring(list(matrix(11:16,3)))))) %>%
# list() %>%
st_sfc() %>%
st_sf()
plot(geom_col)
# convert to SpatVectorsv_geom_col<- vect(geom_col)
# Point is gone without warning
plot(sv_geom_col)
# SpatVectorCollection would seem like the right class for it but doesn't work with sf
svc(geom_col)
The text was updated successfully, but these errors were encountered:
library(terra)
library(sf)
geom_col <- c(st_geometrycollection(list(st_point(1:2), st_linestring(matrix(1:6,3)))),
st_geometrycollection(list(st_multilinestring(list(matrix(11:16,3)))))) %>%
st_sfc() %>% st_sf()
sv_geom_col <- vect(geom_col)
#Warning message:
#[SpatVector from sf] not all geometries were transferred, use svc for a geometry collection
s <- svc(geom_col)
s
# class : SpatVectorCollection
# length : 2
# geometry : lines (2)
# points (1)
Attributes are not transferred yet. I could use a more complex example of an sf object that contains a geometrycollection but also simpler features.
Would it be possible to handle sf geometry collections in a way that preserves all the data? Or if not it would be great if there was a warning that data is being lost.
When I tried to convert an sf object with geometry type "GEOMETRYCOLLECTION" that contains points and lines to a SpatVector it appeared to work but the result only contained the lines.
It would be great if
vect
could detect that it was a "GEOMETRYCOLLECTION" and either produce a warning or maybe iterate over geometry types and then produce a SpatVectorCollection.The text was updated successfully, but these errors were encountered: