[gdal-dev] problems with gdal2tiles and querysize when tiling a
raster
G. Allegri
giohappy at gmail.com
Sat Jan 7 13:53:14 EST 2012
I'm trying to use gdal2tiles to tile a not-georeferenced image (an old map).
The image is a 5816x3961 color jpeg.
Running the following command:
> gdal2tiles -p raster -z "0-3" myimage.jpg myimage_tiles
I obtain 256x256 tile images but the content is wrongly rescaled.
I noticed that the problem happens in the code between lines 1276-127
http://trac.osgeo.org/gdal/browser/tags/1.8.1/gdal/swig/python/scripts/gdal2tiles.py#L1276
where the rescaled is applied based on self.querysize, which by default is
4 times the tile size.
If I change those lines to: (i.e. write the data directly to dstile rather
then dsquery, and commenting the call to the rescaling method)
-----------
dstile.WriteRaster(wx, wy, wxsize, wysize, data,
band_list=list(range(1,self.dataBandsCount+1)))
dstile.WriteRaster(wx, wy, wxsize, wysize, alpha, band_list=[tilebands])
#self.scale_query_to_tile(dsquery, dstile, tilefilename)
------------
everything works perfectly, and I obtain the correct tiles.
I don't know if querysize should me managed differently, or if I'm using
gdal2tiles the wrong way...
giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120107/17965a3f/attachment.html
More information about the gdal-dev
mailing list