powered by
SpatRaster
as_coordinates() returns the position of each cell in the SpatRaster matrix.
as_coordinates()
as_coordinates(x, as.raster = FALSE)
A tibble or a SpatRaster (if as.raster = TRUE) with one row (or cell) for each cell in x.
as.raster = TRUE
x
When as.raster = TRUE, the resulting SpatRaster has the same CRS, extent and resolution as x.
A SpatRaster object.
If TRUE, the result is a SpatRaster object with three layers indicating the position of each cell (cell number, row and column).
TRUE
slice.SpatRaster().
slice.SpatRaster()
Coercing objects: as_sf(), as_spatraster(), as_spatvector(), as_tibble.Spat, fortify.Spat, tidy.Spat
as_sf()
as_spatraster()
as_spatvector()
as_tibble.Spat
fortify.Spat
tidy.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()
Run the code above in your browser using DataLab