When coercing SpatRaster
objects to data frames, x
and y
names are
reserved for geographic coordinates of each cell of the SpatRaster
It
should be also noted that terra allows layers with duplicated
names.
In the process of coercing a SpatRaster
to a tibble, tidyterra
may rename the layers of your SpatRaster
for overcoming this issue.
Specifically, layers may be renamed on the following cases:
Layers with duplicated names.
When coercing to a tibble, if xy = TRUE
, layers named x
or y
would be
renamed.
When working with tidyverse methods (i.e. filter.SpatRaster()
), the
latter would happen as well.
tidyterra would display a message informing of the changes on the
names of the layer.
The same issue happens for SpatVector
with names geometry
(when
geom = c("WKT", "HEX")
) and x
, y
(when geom = "XY"
). These are
reserved names representing the geometry of the SpatVector
(see
terra::as.data.frame()
). If geom
is not NULL
then the logic described
for SpatRaster
would apply as well for the columns of the SpatVector
.