geomtype.Rd
Get the geometry type (points, lines, or polygons) of a SpatVector or the data types of the fields (attributes, variables) of a SpatVector.
# S4 method for SpatVector
geomtype(x)
# S4 method for SpatVector
datatype(x)
# S4 method for SpatVector
is.points(x)
# S4 method for SpatVector
is.lines(x)
# S4 method for SpatVector
is.polygons(x)
# S4 method for SpatRaster
datatype(x, bylyr=TRUE)
SpatVector or SpatRaster
logical. If TRUE
a value is returned for each layer. Otherwise, a value is returned for each data source (such as a file)
character
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
geomtype(v)
#> [1] "polygons"
is.polygons(v)
#> [1] TRUE
is.lines(v)
#> [1] FALSE
is.points(v)
#> [1] FALSE
names(v)
#> [1] "ID_1" "NAME_1" "ID_2" "NAME_2" "AREA" "POP"
datatype(v)
#> [1] "double" "string" "double" "string" "double" "long"