Get tabular information of the attributes of features.

getFeatures(x)

# S4 method for ANY
getFeatures(x)

# S4 method for geom
getFeatures(x)

# S4 method for Spatial
getFeatures(x)

# S4 method for sf
getFeatures(x)

# S4 method for Raster
getFeatures(x)

# S4 method for SpatRaster
getFeatures(x)

# S4 method for matrix
getFeatures(x)

Arguments

x

the object from which to derive the attribute table.

Value

A tibble (or a list of tibbles per layer) of the feature attributes of x.

Details

This table contains at least the column 'fid'. In case x has any typ other than 'grid', it contains also the column 'gid' and in case it has type 'grid', it also contains the column 'values'.

See also

Examples


getFeatures(gtGeoms$polygon)
#> # A tibble: 2 × 2
#>     fid   gid
#>   <int> <int>
#> 1     1     1
#> 2     2     2

gc_sp(gtGeoms$polygon) %>%
  getFeatures()
#> # A tibble: 2 × 2
#>     fid   gid
#>   <int> <int>
#> 1     1     1
#> 2     2     2

gc_sf(gtGeoms$polygon) %>%
  getFeatures()
#> # A tibble: 2 × 2
#>     fid   gid
#>   <dbl> <dbl>
#> 1     1     1
#> 2     2     2

gc_raster(gtGeoms$grid$categorical) %>%
  getFeatures()
#> # A tibble: 3,360 × 2
#>      fid values
#>    <int>  <int>
#>  1     1     31
#>  2     2     31
#>  3     3     47
#>  4     4     47
#>  5     5     47
#>  6     6     47
#>  7     7     47
#>  8     8     47
#>  9     9     47
#> 10    10     47
#> # … with 3,350 more rows

gc_terra(gtGeoms$grid$categorical) %>%
  getFeatures()
#> # A tibble: 3,360 × 2
#>      fid values
#>    <int>  <dbl>
#>  1     1     31
#>  2     2     31
#>  3     3     47
#>  4     4     47
#>  5     5     47
#>  6     6     47
#>  7     7     47
#>  8     8     47
#>  9     9     47
#> 10    10     47
#> # … with 3,350 more rows

getFeatures(x = matrix(0, 3, 5))
#> # A tibble: 15 × 3
#>      fid   gid values
#>    <int> <dbl>  <dbl>
#>  1     1     0      0
#>  2     2     0      0
#>  3     3     0      0
#>  4     4     0      0
#>  5     5     0      0
#>  6     6     0      0
#>  7     7     0      0
#>  8     8     0      0
#>  9     9     0      0
#> 10    10     0      0
#> 11    11     0      0
#> 12    12     0      0
#> 13    13     0      0
#> 14    14     0      0
#> 15    15     0      0