I'm new to GDAL

I try to rasterize a polygon shape file with 'gdal_rasterize' into a tif file.

I burn a fix value 1 into the tif file, (-burn parameter)

Now my problem:

The size of the resulting tif file is independent to the number of polygons nor the size of polygons. Only the extent and resolution seems to define the size of the tif file.

I would expect that with few polygons / small area the size would be smaller than with many polygons / large area to burn.

Is it possible to explain this phenomena?

1 Answer 1


That is because by default your image data is stored uncompressed.

Each pixel of the raster has a potential range of values (the bit depth). Without compression there will be a fixed number of bits reserved for each pixel value, even if one would not actually need as many bits to store the value. So a 0 will take the same amount of bits as a 1000.

Neighboring values are all stored independently. One thousand 0 values in a row will be stored as one thousand 0 values in a row.

To make your raster file smaller you can choose a (lossless) compression. It will usually dramatically reduce the file size. For example it could check if it could store reoccuring values using a more space efficient representation and it could try to be smart about neighboring values.

See GDAL's documentation of TIFF Creation Options at https://gdal.org/drivers/raster/gtiff.html#creation-issues. You can apply them using -co OPTION=VALUE. The specifics of their magic differs but that's for experts.

I recommend you add this to your gdal_rasterize commandline as a good baseline:


Use PREDICTOR=3 if your burned values are floating point numbers, not integers.

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.