constructs an sfc of POLYGON objects

sfc_polygon(
  obj = NULL,
  x = NULL,
  y = NULL,
  z = NULL,
  m = NULL,
  polygon_id = NULL,
  linestring_id = NULL,
  close = TRUE
)

Arguments

obj

sorted matrix or data.frame

x

x geometry column

y

y geometry column

z

z geometry column

m

m geometry column

polygon_id

column of ids for polygons

linestring_id

column of ids for lines (within polygons)

close

logical indicating whether polygons should be closed. If TRUE, all polygons will be checked and force closed if possible

Value

sfc object of POLYGON geometries

notes

sfheaders functions do not perform any validity checks on the geometries. Nor do they set Coordinate Reference Systems, EPSG, PROJ4 or precision attributes.

The data.frame and matrices you send into the sfheader functions must be ordered.

Examples


m <- matrix(c(0,0,0,0,1,1), ncol = 2 )
sfc_polygon( m )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    0    1
#> [4,]    0    0
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    0    1 
#> attr(,"class")
#> [1] "bbox"

m <- matrix(c(0,0,0,0,0,1,0,1,1,1,2,2,1,2,3,1,3,2), ncol = 3, byrow = TRUE)
sfc_polygon( obj = m )
#> [[1]]
#> [[1]]
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    1
#> [3,]    0    1    1
#> [4,]    1    2    2
#> [5,]    1    2    3
#> [6,]    1    3    2
#> [7,]    0    0    0
#> 
#> attr(,"class")
#> [1] "XYZ"     "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    1    3 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax 
#>    0    3 
#> attr(,"class")
#> [1] "z_range"
sfc_polygon( obj = m, polygon_id = 1 )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    1    1
#> [4,]    0    0
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    2    2
#> [2,]    2    3
#> [3,]    3    2
#> [4,]    2    2
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    3    3 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = m, linestring_id = 1 )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    1    1
#> [4,]    0    0
#> 
#> [[2]]
#>      [,1] [,2]
#> [1,]    2    2
#> [2,]    2    3
#> [3,]    3    2
#> [4,]    2    2
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    3    3 
#> attr(,"class")
#> [1] "bbox"

sfc_polygon( obj = m, linestring_id = 1, polygon_id = 1 )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    1    1
#> [4,]    0    0
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    2    2
#> [2,]    2    3
#> [3,]    3    2
#> [4,]    2    2
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    3    3 
#> attr(,"class")
#> [1] "bbox"

sfc_polygon( obj = m, x = 2, y = 3 )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    1    1
#> [4,]    2    2
#> [5,]    2    3
#> [6,]    3    2
#> [7,]    0    0
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    3    3 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = m, x = 1, y = 2, z = 3 )
#> [[1]]
#> [[1]]
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    1
#> [3,]    0    1    1
#> [4,]    1    2    2
#> [5,]    1    2    3
#> [6,]    1    3    2
#> [7,]    0    0    0
#> 
#> attr(,"class")
#> [1] "XYZ"     "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    1    3 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax 
#>    0    3 
#> attr(,"class")
#> [1] "z_range"
sfc_polygon( obj = m, x = 2, y = 3, linestring_id = 1, polygon_id = 1 )
#> [[1]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    0    1
#> [3,]    1    1
#> [4,]    0    0
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>      [,1] [,2]
#> [1,]    2    2
#> [2,]    2    3
#> [3,]    3    2
#> [4,]    2    2
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax 
#>    0    0    3    3 
#> attr(,"class")
#> [1] "bbox"

df <- data.frame(
  ml_id = c(1,1,1,1,1,1,1,1,1,2,2,2,2,2,2)
  , l_id = c(1,1,1,2,2,2,3,3,3,1,1,1,2,2,2)
  , x = rnorm(15)
  , y = rnorm(15)
  , z = rnorm(15)
  , m = rnorm(15)
)

sfc_polygon( obj = df, x = "x", y = "y")
#> [[1]]
#> [[1]]
#>              [,1]       [,2]
#>  [1,] -0.95345329 -0.7484894
#>  [2,] -1.06856889 -1.0255501
#>  [3,]  0.19667499  0.3791427
#>  [4,]  0.79668513 -1.2419510
#>  [5,] -0.04700937  1.4554286
#>  [6,] -0.07184640  1.1263862
#>  [7,]  1.20513372  0.5347640
#>  [8,]  0.03695820 -3.6372192
#>  [9,] -0.09847125  0.4391592
#> [10,] -1.56673977 -1.0108877
#> [11,] -0.46311846  1.8588655
#> [12,]  0.82743029  0.1451856
#> [13,] -2.68929969  0.7335896
#> [14,] -0.96515083  0.5127448
#> [15,] -1.01178533  0.9946689
#> [16,] -0.95345329 -0.7484894
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#> -2.689300 -3.637219  1.205134  1.858865 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = df, x = "x", y = "y", z = "z")
#> [[1]]
#> [[1]]
#>              [,1]       [,2]         [,3]
#>  [1,] -0.95345329 -0.7484894  0.626442960
#>  [2,] -1.06856889 -1.0255501  1.671477702
#>  [3,]  0.19667499  0.3791427  1.100644981
#>  [4,]  0.79668513 -1.2419510  0.007092231
#>  [5,] -0.04700937  1.4554286 -1.288947721
#>  [6,] -0.07184640  1.1263862 -1.769713371
#>  [7,]  1.20513372  0.5347640 -1.029203996
#>  [8,]  0.03695820 -3.6372192 -0.029792080
#>  [9,] -0.09847125  0.4391592  1.051247979
#> [10,] -1.56673977 -1.0108877  0.980804643
#> [11,] -0.46311846  1.8588655 -0.565192054
#> [12,]  0.82743029  0.1451856  0.278201143
#> [13,] -2.68929969  0.7335896 -1.028083656
#> [14,] -0.96515083  0.5127448 -0.976902174
#> [15,] -1.01178533  0.9946689  0.035307260
#> [16,] -0.95345329 -0.7484894  0.626442960
#> 
#> attr(,"class")
#> [1] "XYZ"     "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#> -2.689300 -3.637219  1.205134  1.858865 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -1.769713  1.671478 
#> attr(,"class")
#> [1] "z_range"
sfc_polygon( obj = df, x = "x", y = "y", z = "z", m = "m")
#> [[1]]
#> [[1]]
#>              [,1]       [,2]         [,3]        [,4]
#>  [1,] -0.95345329 -0.7484894  0.626442960 -0.50743399
#>  [2,] -1.06856889 -1.0255501  1.671477702  1.10414897
#>  [3,]  0.19667499  0.3791427  1.100644981  0.21959255
#>  [4,]  0.79668513 -1.2419510  0.007092231 -0.36454731
#>  [5,] -0.04700937  1.4554286 -1.288947721  0.71469148
#>  [6,] -0.07184640  1.1263862 -1.769713371  0.87257724
#>  [7,]  1.20513372  0.5347640 -1.029203996 -0.21928813
#>  [8,]  0.03695820 -3.6372192 -0.029792080 -0.18712359
#>  [9,] -0.09847125  0.4391592  1.051247979  1.33182030
#> [10,] -1.56673977 -1.0108877  0.980804643 -1.21521234
#> [11,] -0.46311846  1.8588655 -0.565192054  0.93788842
#> [12,]  0.82743029  0.1451856  0.278201143 -1.08152697
#> [13,] -2.68929969  0.7335896 -1.028083656  0.07016578
#> [14,] -0.96515083  0.5127448 -0.976902174 -0.38264260
#> [15,] -1.01178533  0.9946689  0.035307260 -0.26200646
#> [16,] -0.95345329 -0.7484894  0.626442960 -0.50743399
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#> -2.689300 -3.637219  1.205134  1.858865 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -1.769713  1.671478 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -1.215212  1.331820 
#> attr(,"class")
#> [1] "m_range"

sfc_polygon( obj = df, x = 2, y = 3)
#> [[1]]
#> [[1]]
#>       [,1]        [,2]
#>  [1,]    1 -0.95345329
#>  [2,]    1 -1.06856889
#>  [3,]    1  0.19667499
#>  [4,]    2  0.79668513
#>  [5,]    2 -0.04700937
#>  [6,]    2 -0.07184640
#>  [7,]    3  1.20513372
#>  [8,]    3  0.03695820
#>  [9,]    3 -0.09847125
#> [10,]    1 -1.56673977
#> [11,]    1 -0.46311846
#> [12,]    1  0.82743029
#> [13,]    2 -2.68929969
#> [14,]    2 -0.96515083
#> [15,]    2 -1.01178533
#> [16,]    1 -0.95345329
#> 
#> attr(,"class")
#> [1] "XY"      "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#>  1.000000 -2.689300  3.000000  1.205134 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = df, x = 2, y = 3, z = 4)
#> [[1]]
#> [[1]]
#>       [,1]        [,2]       [,3]
#>  [1,]    1 -0.95345329 -0.7484894
#>  [2,]    1 -1.06856889 -1.0255501
#>  [3,]    1  0.19667499  0.3791427
#>  [4,]    2  0.79668513 -1.2419510
#>  [5,]    2 -0.04700937  1.4554286
#>  [6,]    2 -0.07184640  1.1263862
#>  [7,]    3  1.20513372  0.5347640
#>  [8,]    3  0.03695820 -3.6372192
#>  [9,]    3 -0.09847125  0.4391592
#> [10,]    1 -1.56673977 -1.0108877
#> [11,]    1 -0.46311846  1.8588655
#> [12,]    1  0.82743029  0.1451856
#> [13,]    2 -2.68929969  0.7335896
#> [14,]    2 -0.96515083  0.5127448
#> [15,]    2 -1.01178533  0.9946689
#> [16,]    1 -0.95345329 -0.7484894
#> 
#> attr(,"class")
#> [1] "XYZ"     "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#>  1.000000 -2.689300  3.000000  1.205134 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -3.637219  1.858865 
#> attr(,"class")
#> [1] "z_range"
sfc_polygon( obj = df, x = 2, y = 3, z = 4, m = 5)
#> [[1]]
#> [[1]]
#>       [,1]        [,2]       [,3]         [,4]
#>  [1,]    1 -0.95345329 -0.7484894  0.626442960
#>  [2,]    1 -1.06856889 -1.0255501  1.671477702
#>  [3,]    1  0.19667499  0.3791427  1.100644981
#>  [4,]    2  0.79668513 -1.2419510  0.007092231
#>  [5,]    2 -0.04700937  1.4554286 -1.288947721
#>  [6,]    2 -0.07184640  1.1263862 -1.769713371
#>  [7,]    3  1.20513372  0.5347640 -1.029203996
#>  [8,]    3  0.03695820 -3.6372192 -0.029792080
#>  [9,]    3 -0.09847125  0.4391592  1.051247979
#> [10,]    1 -1.56673977 -1.0108877  0.980804643
#> [11,]    1 -0.46311846  1.8588655 -0.565192054
#> [12,]    1  0.82743029  0.1451856  0.278201143
#> [13,]    2 -2.68929969  0.7335896 -1.028083656
#> [14,]    2 -0.96515083  0.5127448 -0.976902174
#> [15,]    2 -1.01178533  0.9946689  0.035307260
#> [16,]    1 -0.95345329 -0.7484894  0.626442960
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#>  1.000000 -2.689300  3.000000  1.205134 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -3.637219  1.858865 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -1.769713  1.671478 
#> attr(,"class")
#> [1] "m_range"

sfc_polygon( obj = df, polygon_id = "ml_id", linestring_id = "l_id" )
#> [[1]]
#> [[1]]
#>            [,1]       [,2]     [,3]       [,4]
#> [1,] -0.9534533 -0.7484894 0.626443 -0.5074340
#> [2,] -1.0685689 -1.0255501 1.671478  1.1041490
#> [3,]  0.1966750  0.3791427 1.100645  0.2195925
#> [4,] -0.9534533 -0.7484894 0.626443 -0.5074340
#> 
#> [[2]]
#>             [,1]      [,2]         [,3]       [,4]
#> [1,]  0.79668513 -1.241951  0.007092231 -0.3645473
#> [2,] -0.04700937  1.455429 -1.288947721  0.7146915
#> [3,] -0.07184640  1.126386 -1.769713371  0.8725772
#> [4,]  0.79668513 -1.241951  0.007092231 -0.3645473
#> 
#> [[3]]
#>             [,1]       [,2]        [,3]       [,4]
#> [1,]  1.20513372  0.5347640 -1.02920400 -0.2192881
#> [2,]  0.03695820 -3.6372192 -0.02979208 -0.1871236
#> [3,] -0.09847125  0.4391592  1.05124798  1.3318203
#> [4,]  1.20513372  0.5347640 -1.02920400 -0.2192881
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>            [,1]       [,2]       [,3]       [,4]
#> [1,] -1.5667398 -1.0108877  0.9808046 -1.2152123
#> [2,] -0.4631185  1.8588655 -0.5651921  0.9378884
#> [3,]  0.8274303  0.1451856  0.2782011 -1.0815270
#> [4,] -1.5667398 -1.0108877  0.9808046 -1.2152123
#> 
#> [[2]]
#>            [,1]      [,2]        [,3]        [,4]
#> [1,] -2.6892997 0.7335896 -1.02808366  0.07016578
#> [2,] -0.9651508 0.5127448 -0.97690217 -0.38264260
#> [3,] -1.0117853 0.9946689  0.03530726 -0.26200646
#> [4,] -2.6892997 0.7335896 -1.02808366  0.07016578
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#> -2.689300 -3.637219  1.205134  1.858865 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -1.769713  1.671478 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -1.215212  1.331820 
#> attr(,"class")
#> [1] "m_range"
sfc_polygon( obj = df, polygon_id = 1, linestring_id = 2 )
#> [[1]]
#> [[1]]
#>            [,1]       [,2]     [,3]       [,4]
#> [1,] -0.9534533 -0.7484894 0.626443 -0.5074340
#> [2,] -1.0685689 -1.0255501 1.671478  1.1041490
#> [3,]  0.1966750  0.3791427 1.100645  0.2195925
#> [4,] -0.9534533 -0.7484894 0.626443 -0.5074340
#> 
#> [[2]]
#>             [,1]      [,2]         [,3]       [,4]
#> [1,]  0.79668513 -1.241951  0.007092231 -0.3645473
#> [2,] -0.04700937  1.455429 -1.288947721  0.7146915
#> [3,] -0.07184640  1.126386 -1.769713371  0.8725772
#> [4,]  0.79668513 -1.241951  0.007092231 -0.3645473
#> 
#> [[3]]
#>             [,1]       [,2]        [,3]       [,4]
#> [1,]  1.20513372  0.5347640 -1.02920400 -0.2192881
#> [2,]  0.03695820 -3.6372192 -0.02979208 -0.1871236
#> [3,] -0.09847125  0.4391592  1.05124798  1.3318203
#> [4,]  1.20513372  0.5347640 -1.02920400 -0.2192881
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>            [,1]       [,2]       [,3]       [,4]
#> [1,] -1.5667398 -1.0108877  0.9808046 -1.2152123
#> [2,] -0.4631185  1.8588655 -0.5651921  0.9378884
#> [3,]  0.8274303  0.1451856  0.2782011 -1.0815270
#> [4,] -1.5667398 -1.0108877  0.9808046 -1.2152123
#> 
#> [[2]]
#>            [,1]      [,2]        [,3]        [,4]
#> [1,] -2.6892997 0.7335896 -1.02808366  0.07016578
#> [2,] -0.9651508 0.5127448 -0.97690217 -0.38264260
#> [3,] -1.0117853 0.9946689  0.03530726 -0.26200646
#> [4,] -2.6892997 0.7335896 -1.02808366  0.07016578
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#> 
#> $wkt
#> [1] NA
#> 
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_POLYGON" "sfc"        
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#>      xmin      ymin      xmax      ymax 
#> -2.689300 -3.637219  1.205134  1.858865 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -1.769713  1.671478 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -1.215212  1.331820 
#> attr(,"class")
#> [1] "m_range"