[gdal-dev] Incorrect blank raster example in the FAQ?
Simon (Vsevolod) Ilyushchenko
simonf at simonf.com
Sun Oct 4 18:58:28 EDT 2009
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
More information about the gdal-dev
mailing list