I have a few (very large) GeoTIFFs from a scientific agency that use a single band to categorize each pixel of satellite imagery into one of about 50 categories ("Native forest," "Coffee crops," "Mangroves," etc.) The agency also groups these categories into four larger categories ("Natural," "Developed," "Urban" and "Water") which is what I'm interested in.

For visual purposes, I had no trouble in QGIS mapping each distinct integer to a supercategory in the Symbology, like so:

enter image description hereenter image description here

Because I have files for several years, I want to compare before/after images and thus see whether each unit has changed supercategory since the previous year. (I don't need to know if a farm went from growing citrus to growing cotton -- both in the "developed" category -- but I do need to know if a forest became a farm.) So I would like to apply the category mapping to the data itself and then perform some sort of subtraction.

My first idea was to load the raw data into Python as a huge array and perform a pixel-by-pixel mapping with a dictionary. But as the raw files have about 24 billion pixels, this almost immediately crashes.

Is there a way to do this in QGIS that may be better optimized?

I don't actually need that degree of resolution, so one solution might be to first reduce the resolution.


1 Answer 1


As commented by @GBG you can:

Reclassify by table: https://docs.qgis.org/3.4/en/docs/user_manual/processing_algs/qgis/rasteranalysis.html#reclassify-by-table

Your Answer

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

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