Get a specific layer of a spatial object.
getLayers(x, ...) # S4 method for ANY getLayers(x) # S4 method for geom getLayers(x) # S4 method for Spatial getLayers(x) # S4 method for sf getLayers(x) # S4 method for Raster getLayers(x) # S4 method for SpatRaster getLayers(x) # S4 method for matrix getLayers(x)
x | the object from which to get the layer. |
---|---|
... | other arguments. |
A list of the layers of x
. Each list-item hast the result of
getNames(x) as name.
Other getters:
getCRS()
,
getCols()
,
getExtent()
,
getFeatures()
,
getGroups()
,
getHistory()
,
getNames()
,
getPoints()
,
getRes()
,
getRows()
,
getType()
,
getWindow()
getLayers(gtGeoms$line) #> [[1]] #> geom line #> 2 groups | 2 features | 9 points #> crs cartesian #> attributes -- #> tiny map 50 #> ◌ ○ ○ ◌ #> ◎ ○ ○ ○ #> ◎ ○ ○ ○ #> -50 ◌ ○ ○ ◌ 50 #> -50 gc_sp(gtGeoms$line) %>% getLayers() #> [[1]] #> class : SpatialLines #> features : 2 #> extent : -34.64102, 34.64102, -40, 40 (xmin, xmax, ymin, ymax) #> crs : NA #> gc_sf(gtGeoms$line) %>% getLayers() #> Warning: I can't set name(s) to an object of class 'list'. #> [[1]] #> Simple feature collection with 2 features and 0 fields #> Geometry type: LINESTRING #> Dimension: XY #> Bounding box: xmin: -34.64102 ymin: -40 xmax: 34.64102 ymax: 40 #> CRS: NA #> geom #> 1 LINESTRING (0 -40, 34.64102... #> 2 LINESTRING (-34.64102 20, -... #> gc_raster(gtGeoms$grid$categorical) %>% getLayers() #> [[1]] #> class : RasterLayer #> dimensions : 56, 60, 3360 (nrow, ncol, ncell) #> resolution : 1, 1 (x, y) #> extent : 0, 60, 0, 56 (xmin, xmax, ymin, ymax) #> crs : NA #> source : memory #> names : layer #> values : 1, 47 (min, max) #> attributes : #> gid cover #> from: 1 lake #> to : 47 mixed forest #> #> gc_terra(gtGeoms$grid$categorical) %>% getLayers() #> [[1]] #> class : SpatRaster #> dimensions : 56, 60, 1 (nrow, ncol, nlyr) #> resolution : 1, 1 (x, y) #> extent : 0, 60, 0, 56 (xmin, xmax, ymin, ymax) #> coord. ref. : lon/lat WGS 84 #> source : memory #> name : cover #> min value : arable #> max value : wetland #> getLayers(x = matrix(0, 3, 5)) #> [[1]] #> [,1] [,2] [,3] [,4] [,5] #> [1,] 0 0 0 0 0 #> [2,] 0 0 0 0 0 #> [3,] 0 0 0 0 0 #>