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 < 
>[email protected] >:
> 
>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 < [email protected] > käyttäjän Andrey VI 
>via gdal-dev < [email protected] > puolesta
>Lähetetty: Maanantai 6. lokakuuta 2025 10.59
>Vastaanottaja:  [email protected] < [email protected] >
>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
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to