Re: [R] Calculating volume under polygons

2023-11-21 Thread Micha Silver
Again, please keep communication on the maillist, to help others as well. The R spatial maillist is R-sig-Geo in case you want to continue there. Here's my solution. I read in your layers, then looped over all polygons. Inside the loop I extract the minimum value of the DEM, then subtract tha

Re: [R] Calculating volume under polygons

2023-11-20 Thread Micha Silver
(Keeping on the list. And consider my suggestion to move this to R-sig-Geo) What is the coordinate reference system of the polygon layer? Can you share these layers? On 21/11/2023 4:58, javad bayat wrote: Dear Micha; Thank you for your reply. The R version is 4.3.2, the raster package is "r

Re: [R] Calculating volume under polygons

2023-11-20 Thread Micha Silver
Hi: Some preliminary comments first 1- You might get a better response posting to R-sig-Geo 2- Probably better to switch to the `terra` package instead of the older `raster` 3- Furthermore, there is the package `exactextractr` that ensures that edge pixels are taken into account, weighted b