I try to crop
(terra
) a SpatRaster from ForestClim database (here ex. with first variable from ForestClim https://figshare.com/ndownloader/files/39164684) with shapefile, to keep for exemple only raster in Belgium, like this
# shapefile
ISO <- countrycode("Belgium", origin = 'country.name', destination = 'iso3c')
shp <- gadm(country=ISO, level=0,
path = tempdir(),
version="latest")
crs(shp) <- "epsg:4326"
# raster
r <- rast(~/Downloads/ForestClim_01.tif) # download link above
crs(r) <- "epsg:4326"
# crop
cr <- crop(r, shp, mask=TRUE, overwrite=TRUE)
Error: [crop] extents do not overlap
I try to understand but without success,
I don’t understand why this doesn’t work, because it worked perfectly with CHELSA data.
Thanks a lot for any help or suggestions.