[gdal-dev] gdal rasterize vs resize
Scott
public at postholer.com
Sun Nov 16 11:33:09 PST 2025
Hey Jukka,
Yes, the behavior has existed for quite some time on the utilities. If
you know the extent it's easy to calculate the -tr, (max - min) / pixels.
Being that the functionality exists elsewhere and given the fact that
I'm LAZY, it would be nice to have everywhere. :)
Thanks!
Scott
On 11/16/25 11:04, Rahkonen Jukka wrote:
> Hi,
>
> I believe it would not be extremely hard to compute the other size parameter so that the result would have square pixels. As a workaround, if you can guess an about suitable pixel size you can define the resolution with equal x and y size:
> gdal vector rasterize --resolution [pixelsize,pixelsize]
>
> The behavior is not new. The traditional gdal_rasterize https://gdal.org/en/stable/programs/gdal_rasterize.html requires also both width and height.
>
> -Jukka Rahkonen-
>
> ________________________________________
> Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> käyttäjän Scott via gdal-dev <gdal-dev at lists.osgeo.org> puolesta
> Lähetetty: Lauantai 15. marraskuuta 2025 21.45
> Vastaanottaja: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
> Aihe: [gdal-dev] gdal rasterize vs resize
>
>
> Greetings,
>
> When using gdal raster resize I can use --size 0,800 and it will compute
> the width.
>
> However, when using gdal vector rasterize --size 0,800 it throws the error:
>
> ERROR 1: Wrong value for -ts parameter.
>
> Having it compute the missing value is highly desirable!
>
> GDAL v3.12.0
>
> Thanks!
> Scott
>
> --
> http://www.postholer.com/
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
More information about the gdal-dev
mailing list