[gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missing
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Mon Oct 6 03:01:50 PDT 2025
Hi,
I have seen people using GDAL commands which do not make sense, that happens for everybody, but obviously not this time.
I can see two issues:
- The error message does not tell what is the real issue
- The real issue is documented in https://gdal.org/en/stable/drivers/raster/cog.html#update, but I am not sure how to set the IGNORE_COG_LAYOUT_BREAK open option with gdal_rasterize.
-Jukka Rahkonen-
________________________________________
Lähettäjä: Andrey VI <andrey_vi at list.ru>
Lähetetty: Maanantai 6. lokakuuta 2025 12.18
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
Kopio: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missing
Of course in my example the file exists. Otherwise this command would not make sense without -ts or -ts options.I figured out what the problem was. Existed raster was created with COG layout. And in this case gdal_rasterize error (Size and resolution are missing) is very confusing. Monday, October 6, 2025 11:32 AM +03:00 from Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>: Hi,Are you sure that it worked likegdal_rasterize -burn 0 shape.shp hillshade.tifif 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 <[/compose?To=gdal%2ddev%2dbounces at lists.osgeo.org]gdal-dev-bounces at lists.osgeo.org> käyttäjän Andrey VI via gdal-dev <[/compose?To=gdal%2ddev at lists.osgeo.org]gdal-dev at lists.osgeo.org> puolestaLähetetty: Maanantai 6. lokakuuta 2025 10.59Vastaanottaja: [/compose?To=gdal%2ddev at lists.osgeo.org]gdal-dev at lists.osgeo.org <[/compose?To=gdal%2ddev at lists.osgeo.org]gdal-dev at lists.osgeo.org>Aihe: [gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missingHello. 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--Andrey VISent from Mail
More information about the gdal-dev
mailing list