Skip to contents

constructs an sfc of POLYGON objects

Usage

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,] -1.40763892 -2.085070889
#>  [2,]  0.70917846  0.003567992
#>  [3,] -1.24084294 -0.355770822
#>  [4,] -0.36832735  1.146359751
#>  [5,]  0.46208009 -0.221188446
#>  [6,] -0.32283310  1.018179021
#>  [7,] -1.28721481 -0.263719295
#>  [8,] -1.03004025  1.658542305
#>  [9,]  1.51408932 -0.774086771
#> [10,]  0.34690359 -0.923937880
#> [11,]  1.77944154 -0.275533378
#> [12,]  0.38663092 -0.593399688
#> [13,] -0.91869524 -0.122285891
#> [14,] -1.58433649  1.179784246
#> [15,] -0.08405889  0.641037374
#> [16,] -1.40763892 -2.085070889
#> 
#> 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.584336 -2.085071  1.779442  1.658542 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = df, x = "x", y = "y", z = "z")
#> [[1]]
#> [[1]]
#>              [,1]         [,2]       [,3]
#>  [1,] -1.40763892 -2.085070889 -0.6295885
#>  [2,]  0.70917846  0.003567992 -0.8077350
#>  [3,] -1.24084294 -0.355770822 -0.8604899
#>  [4,] -0.36832735  1.146359751 -2.1692387
#>  [5,]  0.46208009 -0.221188446 -1.3758365
#>  [6,] -0.32283310  1.018179021 -0.4931325
#>  [7,] -1.28721481 -0.263719295 -0.5816520
#>  [8,] -1.03004025  1.658542305 -0.1672293
#>  [9,]  1.51408932 -0.774086771  0.4859931
#> [10,]  0.34690359 -0.923937880 -1.3333958
#> [11,]  1.77944154 -0.275533378 -0.2619656
#> [12,]  0.38663092 -0.593399688  0.6523863
#> [13,] -0.91869524 -0.122285891  0.7488550
#> [14,] -1.58433649  1.179784246  0.8965603
#> [15,] -0.08405889  0.641037374  1.4893004
#> [16,] -1.40763892 -2.085070889 -0.6295885
#> 
#> 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.584336 -2.085071  1.779442  1.658542 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.169239  1.489300 
#> attr(,"class")
#> [1] "z_range"
sfc_polygon( obj = df, x = "x", y = "y", z = "z", m = "m")
#> [[1]]
#> [[1]]
#>              [,1]         [,2]       [,3]        [,4]
#>  [1,] -1.40763892 -2.085070889 -0.6295885 -0.65940348
#>  [2,]  0.70917846  0.003567992 -0.8077350  0.53728318
#>  [3,] -1.24084294 -0.355770822 -0.8604899  0.74680307
#>  [4,] -0.36832735  1.146359751 -2.1692387  1.89631708
#>  [5,]  0.46208009 -0.221188446 -1.3758365 -2.06007072
#>  [6,] -0.32283310  1.018179021 -0.4931325  0.06454387
#>  [7,] -1.28721481 -0.263719295 -0.5816520 -0.26514740
#>  [8,] -1.03004025  1.658542305 -0.1672293 -0.44734453
#>  [9,]  1.51408932 -0.774086771  0.4859931 -1.41070093
#> [10,]  0.34690359 -0.923937880 -1.3333958 -0.50641888
#> [11,]  1.77944154 -0.275533378 -0.2619656 -0.26976184
#> [12,]  0.38663092 -0.593399688  0.6523863 -1.08515492
#> [13,] -0.91869524 -0.122285891  0.7488550  0.36215913
#> [14,] -1.58433649  1.179784246  0.8965603 -0.33567214
#> [15,] -0.08405889  0.641037374  1.4893004  1.36380450
#> [16,] -1.40763892 -2.085070889 -0.6295885 -0.65940348
#> 
#> 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.584336 -2.085071  1.779442  1.658542 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.169239  1.489300 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -2.060071  1.896317 
#> attr(,"class")
#> [1] "m_range"

sfc_polygon( obj = df, x = 2, y = 3)
#> [[1]]
#> [[1]]
#>       [,1]        [,2]
#>  [1,]    1 -1.40763892
#>  [2,]    1  0.70917846
#>  [3,]    1 -1.24084294
#>  [4,]    2 -0.36832735
#>  [5,]    2  0.46208009
#>  [6,]    2 -0.32283310
#>  [7,]    3 -1.28721481
#>  [8,]    3 -1.03004025
#>  [9,]    3  1.51408932
#> [10,]    1  0.34690359
#> [11,]    1  1.77944154
#> [12,]    1  0.38663092
#> [13,]    2 -0.91869524
#> [14,]    2 -1.58433649
#> [15,]    2 -0.08405889
#> [16,]    1 -1.40763892
#> 
#> 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 -1.584336  3.000000  1.779442 
#> attr(,"class")
#> [1] "bbox"
sfc_polygon( obj = df, x = 2, y = 3, z = 4)
#> [[1]]
#> [[1]]
#>       [,1]        [,2]         [,3]
#>  [1,]    1 -1.40763892 -2.085070889
#>  [2,]    1  0.70917846  0.003567992
#>  [3,]    1 -1.24084294 -0.355770822
#>  [4,]    2 -0.36832735  1.146359751
#>  [5,]    2  0.46208009 -0.221188446
#>  [6,]    2 -0.32283310  1.018179021
#>  [7,]    3 -1.28721481 -0.263719295
#>  [8,]    3 -1.03004025  1.658542305
#>  [9,]    3  1.51408932 -0.774086771
#> [10,]    1  0.34690359 -0.923937880
#> [11,]    1  1.77944154 -0.275533378
#> [12,]    1  0.38663092 -0.593399688
#> [13,]    2 -0.91869524 -0.122285891
#> [14,]    2 -1.58433649  1.179784246
#> [15,]    2 -0.08405889  0.641037374
#> [16,]    1 -1.40763892 -2.085070889
#> 
#> 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 -1.584336  3.000000  1.779442 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.085071  1.658542 
#> 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 -1.40763892 -2.085070889 -0.6295885
#>  [2,]    1  0.70917846  0.003567992 -0.8077350
#>  [3,]    1 -1.24084294 -0.355770822 -0.8604899
#>  [4,]    2 -0.36832735  1.146359751 -2.1692387
#>  [5,]    2  0.46208009 -0.221188446 -1.3758365
#>  [6,]    2 -0.32283310  1.018179021 -0.4931325
#>  [7,]    3 -1.28721481 -0.263719295 -0.5816520
#>  [8,]    3 -1.03004025  1.658542305 -0.1672293
#>  [9,]    3  1.51408932 -0.774086771  0.4859931
#> [10,]    1  0.34690359 -0.923937880 -1.3333958
#> [11,]    1  1.77944154 -0.275533378 -0.2619656
#> [12,]    1  0.38663092 -0.593399688  0.6523863
#> [13,]    2 -0.91869524 -0.122285891  0.7488550
#> [14,]    2 -1.58433649  1.179784246  0.8965603
#> [15,]    2 -0.08405889  0.641037374  1.4893004
#> [16,]    1 -1.40763892 -2.085070889 -0.6295885
#> 
#> 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 -1.584336  3.000000  1.779442 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.085071  1.658542 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -2.169239  1.489300 
#> attr(,"class")
#> [1] "m_range"

sfc_polygon( obj = df, polygon_id = "ml_id", linestring_id = "l_id" )
#> [[1]]
#> [[1]]
#>            [,1]         [,2]       [,3]       [,4]
#> [1,] -1.4076389 -2.085070889 -0.6295885 -0.6594035
#> [2,]  0.7091785  0.003567992 -0.8077350  0.5372832
#> [3,] -1.2408429 -0.355770822 -0.8604899  0.7468031
#> [4,] -1.4076389 -2.085070889 -0.6295885 -0.6594035
#> 
#> [[2]]
#>            [,1]       [,2]       [,3]        [,4]
#> [1,] -0.3683273  1.1463598 -2.1692387  1.89631708
#> [2,]  0.4620801 -0.2211884 -1.3758365 -2.06007072
#> [3,] -0.3228331  1.0181790 -0.4931325  0.06454387
#> [4,] -0.3683273  1.1463598 -2.1692387  1.89631708
#> 
#> [[3]]
#>           [,1]       [,2]       [,3]       [,4]
#> [1,] -1.287215 -0.2637193 -0.5816520 -0.2651474
#> [2,] -1.030040  1.6585423 -0.1672293 -0.4473445
#> [3,]  1.514089 -0.7740868  0.4859931 -1.4107009
#> [4,] -1.287215 -0.2637193 -0.5816520 -0.2651474
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>           [,1]       [,2]       [,3]       [,4]
#> [1,] 0.3469036 -0.9239379 -1.3333958 -0.5064189
#> [2,] 1.7794415 -0.2755334 -0.2619656 -0.2697618
#> [3,] 0.3866309 -0.5933997  0.6523863 -1.0851549
#> [4,] 0.3469036 -0.9239379 -1.3333958 -0.5064189
#> 
#> [[2]]
#>             [,1]       [,2]      [,3]       [,4]
#> [1,] -0.91869524 -0.1222859 0.7488550  0.3621591
#> [2,] -1.58433649  1.1797842 0.8965603 -0.3356721
#> [3,] -0.08405889  0.6410374 1.4893004  1.3638045
#> [4,] -0.91869524 -0.1222859 0.7488550  0.3621591
#> 
#> 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.584336 -2.085071  1.779442  1.658542 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.169239  1.489300 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -2.060071  1.896317 
#> attr(,"class")
#> [1] "m_range"
sfc_polygon( obj = df, polygon_id = 1, linestring_id = 2 )
#> [[1]]
#> [[1]]
#>            [,1]         [,2]       [,3]       [,4]
#> [1,] -1.4076389 -2.085070889 -0.6295885 -0.6594035
#> [2,]  0.7091785  0.003567992 -0.8077350  0.5372832
#> [3,] -1.2408429 -0.355770822 -0.8604899  0.7468031
#> [4,] -1.4076389 -2.085070889 -0.6295885 -0.6594035
#> 
#> [[2]]
#>            [,1]       [,2]       [,3]        [,4]
#> [1,] -0.3683273  1.1463598 -2.1692387  1.89631708
#> [2,]  0.4620801 -0.2211884 -1.3758365 -2.06007072
#> [3,] -0.3228331  1.0181790 -0.4931325  0.06454387
#> [4,] -0.3683273  1.1463598 -2.1692387  1.89631708
#> 
#> [[3]]
#>           [,1]       [,2]       [,3]       [,4]
#> [1,] -1.287215 -0.2637193 -0.5816520 -0.2651474
#> [2,] -1.030040  1.6585423 -0.1672293 -0.4473445
#> [3,]  1.514089 -0.7740868  0.4859931 -1.4107009
#> [4,] -1.287215 -0.2637193 -0.5816520 -0.2651474
#> 
#> attr(,"class")
#> [1] "XYZM"    "POLYGON" "sfg"    
#> 
#> [[2]]
#> [[1]]
#>           [,1]       [,2]       [,3]       [,4]
#> [1,] 0.3469036 -0.9239379 -1.3333958 -0.5064189
#> [2,] 1.7794415 -0.2755334 -0.2619656 -0.2697618
#> [3,] 0.3866309 -0.5933997  0.6523863 -1.0851549
#> [4,] 0.3469036 -0.9239379 -1.3333958 -0.5064189
#> 
#> [[2]]
#>             [,1]       [,2]      [,3]       [,4]
#> [1,] -0.91869524 -0.1222859 0.7488550  0.3621591
#> [2,] -1.58433649  1.1797842 0.8965603 -0.3356721
#> [3,] -0.08405889  0.6410374 1.4893004  1.3638045
#> [4,] -0.91869524 -0.1222859 0.7488550  0.3621591
#> 
#> 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.584336 -2.085071  1.779442  1.658542 
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#>      zmin      zmax 
#> -2.169239  1.489300 
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#>      mmin      mmax 
#> -2.060071  1.896317 
#> attr(,"class")
#> [1] "m_range"