I have a dataset of POINTS with Z values and I would like to convert it to a MULTIPOINT dataset grouped by ID
I used the code from Converting points to polygons by group and it successfully grouped my points to multipoint but it dropped the z value.
Here is the code from the top answer of the other question which I based my own on:
set.seed(999)
xy = data.frame(x=runif(24), y=runif(24))
xy$ID = rep(1:6, each = 4)
head(xy)
xys = st_as_sf(xy, coords=c("x","y"))
polys = xys %>%
dplyr::group_by(ID) %>%
dplyr::summarise() %>%
st_cast("POLYGON")
plot(polys)
Here is what I actually used on my data
lsp_mp2 <- lsp %>%
dplyr::group_by(lsp$ID) %>%
dply::summarise() %>%
st_cast('MULTIPOINT')
How do I retain the Z value?
There is a column in my data with a Z value. The output of this function gave me an attribute table with only one column. All of the other columns were lost with this function.