I am pretty new to QGIS. I have a .tif file (Land-Ocean mask) with a high spatial resolution (150m) on a global scale. I would like to first resize it to 0.25-degree spatial resolution, and then calculate the number of those pixels/grids from the high-resolution layer (150m), that fall within the pixels of the coarser spatial resolution layer (0.25-degree). The values of the Land-Ocean mask are defined as 0/1 for Ocean and Land. I think for the resizing/resampling if right-click on the raster layer then Export > save as, and from there changing the Resolution to 0.25 would be the case to have the coarser layer.

If I am right, how do I count/sum the number of those pixels as a new layer?

1 Answer 1


If I understood correctly what you are trying to do, you could create a 0.25 grid without having to resample your original data raster. To do that, you can download mmqgis plugin (Plugins -> Manage and Install Plugins and then just search mmqgis) and create your grid with that. Click MMQGIS -> Create -> Create Grid Layer and select rectangle as geometry type degrees as grid units.

You can then convert your ocean/land pixels to points and count/sum ocean/land points for each grid cell. To do this, search "Raster pixels to points" in Processing Toolbox and create your point data after which you can create own layers for ocean and land data by selecting data and exporting the selection (Open layer attribute table -> Select features using an expression -> <your_field_name> = 0 (or 1). Then Export -> Save selected features as). Lastly, search "Count points in polygon" in Processing Toolbox and use that tool to create your result layer.

However, if you want to change the resolution of your raster by resampling, one way to do it is to go to Raster -> Align Rasters. There, just add the raster you want to resample, select resampling method and modify the cell size. Remember to tick "Rescale values according to the cell size".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.