[gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missing

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Mon Oct 6 01:32:21 PDT 2025


Hi,

Are you sure that it worked like 
gdal_rasterize -burn 0 shape.shp hillshade.tif
if hillshade.tif file did not exist? It the file exists then the command should still work. Examples 1 and 2 are burning geometries into an existing file. The example 3 writes a new tif and it includes the target size parameter "-ts 1000 1000".
The error "Size and resolution are missing" is slightly wrong, it should be "Size OR resolution are missing". You do not need both, and actually user would need to be careful for making them match because they depend on each other.

In conclusion, you wrote "This means that to use the gdal_rasterize, you first need to know the raster size or resolution."
- If the target image exists all you need to know is the name of the file
- If target image does not exists, you really need to know what resolution or image size in pixels you want. GDAL does not guess what resolution might please you.

-Jukka Rahkonen-

________________________________________
Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> käyttäjän Andrey VI via gdal-dev <gdal-dev at lists.osgeo.org> puolesta
Lähetetty: Maanantai 6. lokakuuta 2025 10.59
Vastaanottaja: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missing

Hello. A few years ago a command like this:gdal_rasterize -burn 0 shape.shp hillshade.tifworked.But with the latest GDAL it’s not:gdal_rasterize -burn 0 shape.shp hillshade.tifERROR 1: Size and resolution are missing gdal_rasterize examples section of GDAL documentation includes 2 examples without size and resolution options.This means that to use the gdal_rasterize, you first need to know the raster size or resolution. This is inconvenient. Is this a bug or an intentional change?--Andrey


More information about the gdal-dev mailing list