Extracting data from raster file to match with shp file
问题 UPDATE: UPDATE: The problem was that my way to produce the grid cells has led to a wrong projection of my shapefile which resulted in the above mentioned error. I was able to produce another form of grid cells that worked perfectly with my projection. After I successfully created a raster grid for the world map (How to generate 10x10km grid cells of all countries?) library(sf) library(stars) library(rnaturalearth) # Polygon world = ne_countries(scale = "small", returnclass = "sf") world = st