[GIS] R How to multiply the values of the raster pixels with the true surfaces of these pixels

areapixelrraster

I want to multiply the precipitation values (mm) of each pixel of a raster by the area corresponding to each of these pixels under R.

At first, I directly multiplied the raster by the average pixel area (Total area / number of pixels). But if we work on a global scale with the WGS84 projection, in reality the pixel area at the equator and in the high latitude regions is very different? That is why I am asking this question.

Best Answer

The raster package has a pixel area calculation function for unprojected rasters. Given a RasterLayer named r

library(raster)

area(r) * r
Related Question