I am using the extract function from the raster package in R.
The extract function is taking incredibly long to assign the values to the polygon. In ArcMap, this process is much faster (but of course more time consuming to set up).
CVsteepslope is the raster (100m resolution) and grids (3,000,000 objects) is my polygon.
Here is the code:
CVsteepslope <- CVsteepslope %>%
projectRaster(CVsteepslope, crs="EPSG:3035")
# here I am reducing the raster to the polygon extent in an attempt to speed things up
CVsteepslope <- crop(CVsteepslope, extent(gridsdiss), snap="out")
CVsteepslope <- rasterize(gridsdiss, CVsteepslope)
CVsteepslope <- mask(x=CVsteepslope, mask=CVp)
grids$steepslope <- as.numeric(extract(CVsteepslope, grids, method='bilinear', small=TRUE, fun=mean))
Side note: I am using a virtual environment with 128 gb memory, R is only using a third of this.
raster::extract
raster::extract
. gis.stackexchange.com/questions/393822/…