[gdal-dev] gdal_rasterize ERROR 1: Size and resolution are missing
Andrey VI
andrey_vi at list.ru
Mon Oct 6 02:18:11 PDT 2025
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 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
--
Andrey VI
Sent from Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20251006/5ef26c38/attachment-0001.htm>
More information about the gdal-dev
mailing list