# Calculate value per unit area from raster in QGIS

I have a raster (GeoTIFF) of number of people per pixel. I would like to convert this to a new raster of population per unit area. In other words, I would like to divide each value in my existing raster by the area of that pixel. The raster is given in geographic coordinates (lon./lat.), so the area of the pixels is not constant.

How can I do this in QGIS? I thought maybe pixel area would be a variable that could be accessed in the raster calculator. I could do some processing separately in Python but I am hoping there will be a more convenient approach.

• If you're using the same GPW data I have, I believe it includes "land area" as one of the fields, which might be a better estimate of population density (which GPW has a separate TIFF file for if you want it) than the entire tile area. As you note, computing the pixel area should be fairly simple, remembering that each degree of longitude is cos(latitude) degrees of latitude Commented Aug 25, 2022 at 14:50

Encouraged by the second half of the comment from @Barry, I calculated the density by first using the SAGA calculator (SAGA > Raster calculus > Raster calculator) to calculate the area of each pixel as follows:

Size of cell in degrees 0.0008333333299919803679

Area of cell in square degrees 0.0008333333299919803679 ** 2 = 0.000000694444439

Square metres per square degree at equator ((2 * pi * 6371000.0) / 360.0) ** 2 = (111194.926645) ** 2 = 12364311711.6

Area of cell in square metres at equator: 0.000000694444439 * 12364311711.6 = 8586.32751018

Latitude in radians (in Saga syntax) ypos() * 0.01745329252

Area of cell: 8586.32751018 * cos(ypos() * 0.01745329252)

This creates a new raster of the pixel areas. The original raster can then be divided by the new raster to give the density (as a third raster) using the default raster calculator.