Geometrically subset SpatRaster or SpatVector (to be done) by drawing on a plot (map).
# S4 method for SpatRaster
select(x, ...)
SpatRaster or SpatVector
additional arguments passed on to draw
SpatRaster or SpatVector
# NOT RUN {
# select a subset of a RasterLayer
r <- rast(nrow=10, ncol=10)
values(r) <- 1:ncell(r)
plot(r)
s <- select(r) # now click on the map twice
# plot the selection on a new canvas:
x11()
plot(s)
# }
Run the code above in your browser using DataLab