Closed dcooley closed 4 years ago
So prompt!
I think that would make it possible to create sf (or wksxp, although I really should make that format align more closely with sf) without any looping over afterward to set more attributes. sf does this all with class
, but wksxp does it slightly differently to make the parsing code cleaner.
lapply(sf::st_sfc(sf::st_point(c(1, 2, 3))), attributes)
#> [[1]]
#> [[1]]$class
#> [1] "XYZ" "POINT" "sfg"
lapply(unclass(wk::as_wksxp("POINT Z (1 2 3)")), attributes)
#> [[1]]
#> [[1]]$dim
#> [1] 1 3
#>
#> [[1]]$class
#> [1] "wk_point"
#>
#> [[1]]$has_z
#> [1] TRUE
Created on 2020-07-09 by the reprex package (v0.3.0)
I think that would make it possible to create sf
sf
only needs the StringVector
class for each individual sfg
geometry. So this current implementation is fine for making sfg
, then sfc
, then sf
objects as-is. But I agree it would be better to make this more generic and accept a list of attributes.
To clarify, the make_geometries()
function makes individual geometries (i.e, sfg
) for each level-1 ID. Then the list that all those sfg
s are contained in is the sfc
https://github.com/paleolimbot/geovctrs/issues/8#issuecomment-656407607