Get the type of a spatial object.

getType(x, ...)

# S4 method for ANY
getType(x)

# S4 method for geom
getType(x)

# S4 method for Spatial
getType(x)

# S4 method for sf
getType(x)

# S4 method for Raster
getType(x)

# S4 method for SpatRaster
getType(x)

# S4 method for matrix
getType(x)

Arguments

x

the object for which to determine the type.

...

other arguments.

Value

A vector of two values of the geometry type (point/line/polygon/grid) and the specific main type/class of x.

See also

Examples

getType(x = gtGeoms$point)
#> [1] "point" "point"

gc_sp(gtGeoms$line) %>%
  getType()
#> [1] "line"         "SpatialLines"

gc_sf(gtGeoms$polygon) %>%
  getType()
#> [1] "polygon" "POLYGON"

gc_raster(gtGeoms$grid$categorical) %>%
  getType()
#> [1] "grid"        "RasterLayer"

gc_terra(gtGeoms$grid$categorical) %>%
  getType()
#> [1] "grid"       "SpatRaster"

getType(x = matrix(0, 3, 5))
#> [1] "grid"   "matrix"