View source: R/as_coordinates.R
as_coordinates | R Documentation |
SpatRaster
as_coordinates()
can be used to obtain the position of each cell on the
SpatRaster
matrix.
as_coordinates(x, as.raster = FALSE)
x |
A |
as.raster |
If |
A tibble
or a SpatRaster
(if as.raster = TRUE
) with
the same number of rows (or cells) than the number of cells in x
.
When as.raster = TRUE
the resulting SpatRaster
has the same crs,
extension and resolution than x
slice.SpatRaster()
Coercing objects:
as_sf()
,
as_spatraster()
,
as_spatvector()
,
as_tibble.Spat
,
fortify.Spat
library(terra)
f <- system.file("extdata/cyl_temp.tif", package = "tidyterra")
r <- rast(f)
as_coordinates(r)
as_coordinates(r, as.raster = TRUE)
as_coordinates(r, as.raster = TRUE) %>% plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.