Get the number of columns of a spatial object.

getCols(x, ...)

# S4 method for ANY
getCols(x)

# S4 method for geom
getCols(x)

# S4 method for Raster
getCols(x)

# S4 method for SpatRaster
getCols(x)

# S4 method for matrix
getCols(x)

Arguments

x

the object from which to get the number of columns.

...

other arguments.

Value

An integer of the number of columns.

See also

Examples


getCols(gtGeoms$grid$categorical)
#> [1] 60

gc_raster(gtGeoms$grid$categorical) %>%
  getCols()
#> [1] 60

gc_terra(gtGeoms$grid$categorical) %>%
  getCols()
#> [1] 60

getCols(x = matrix(0, 3, 5))
#> [1] 5