I have a raster layer of which I would need to find the area (m2) per cell. Any suggestions for a simple approach to achieve this?
Your question is not well constrained. If you are wondering how to find the area of a cell from a raster that is unprojected and aligned to WGS84 grid (e.g. epsg:4326), then the following Python code should help.
import numpy as np import rasterio fp = 'your_tiff_file.tif' with rasterio.open(fp) as testif: rast = testif.read(1) gt = testif.transform pix_width = gt ulX = gt ulY = gt rows = testif.height cols = testif.width lrX = ulX + gt * cols lrY = ulY + gt * rows lats = np.linspace(ulY,lrY,rows+1) a = 6378137 b = 6356752.3142 # Degrees to radians lats = lats * np.pi/180 # Intermediate vars e = np.sqrt(1-(b/a)**2) sinlats = np.sin(lats) zm = 1 - e * sinlats zp = 1 + e * sinlats # Distance between meridians # q = np.diff(longs)/360 q = pix_width/360 # Compute areas for each latitude in square km areas_to_equator = np.pi * b**2 * ((2*np.arctanh(e*sinlats) / (2*e) + sinlats / (zp*zm))) / 10**6 areas_between_lats = np.diff(areas_to_equator) areas_cells = np.abs(areas_between_lats) * q areagrid = np.transpose(np.matlib.repmat(areas_cells,cols,1))
This snippet returns the array
areagrid that contains the area in square kilometers of each pixel in your 4326 raster. There are a number of considerations "under the hood" that I am not detailing here, but I will note that I have compared this method with reprojection methods and the results have always been very similar.
You asked for a QGIS solution, so you would have to modify this a bit to get it to run in the Python console. Maybe overkill for what you want.