[gdal-dev] Incorrect blank raster example in the FAQ?

Even Rouault even.rouault at mines-paris.org
Mon Oct 5 14:18:13 EDT 2009


Selon "Simon (Vsevolod) Ilyushchenko" <simonf at simonf.com>:

Yes, your proposal is better and deals with non-square pixel. So I've changed
the wiki page accordingly. Thanks!

> Hi,
>
> I'm new to gdal, so I could be very wrong about this.
>
> When I tried to follow the example in
>
http://trac.osgeo.org/gdal/wiki/FAQRaster#HowcanIcreateablankrasterbasedonavectorfilesextentsforusewithgdal_rasterize
> to generate a blank geotiff based on a shapefile, I got incorrect
> results. Here's what I had to change to generate the correct geotiff.
>
> Instead of:
>
> raster_transform = [src_extent[0], px, 0.0, src_extent[3], 0.0, -px]
>
> I used:
>
> x_scale = (src_extent[1] - src_extent[0]) / tiff_width
> y_scale = (src_extent[3] - src_extent[2]) / tiff_height
> raster_transform = [src_extent[0], x_scale, 0.0, src_extent[3], 0.0,
> -y_scale]
>
> I'm not using the px variable at all.
>
> Should the answer be changed, or am I misunderstanding something?
>
> Thanks,
> Simon
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list