Examples for 'sfheaders::sf_mpoly'


Helper for sf MULTIPOLYGON

Aliases: sf_mpoly

Keywords:

### ** Examples


m <- matrix(c(0,0,0,0,1,0,0,1,1,0,0,1,0,0,0), ncol = 3, byrow = TRUE,
      dimnames = list(NULL, c("x", "y", "z")))
m <- cbind(m, multipolygon_id = 1, polygon_id = 1, linestring_id = 1)
sf_mpoly( m )
  multipolygon_id                                    geometry
1               1 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0
df <- as.data.frame(m)

sf_mpoly( df)
  multipolygon_id                                    geometry
1               1 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0
## order doesn't matter, only the names are used
sf_mpoly(df[c(6, 5, 3, 4, 1, 2)])
  multipolygon_id                                    geometry
1               1 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0

[Package sfheaders version 0.4.4 Index]