[gdal-dev] gdal2tiles.py and dateline gap
Klokan Petr Přidal
klokan at klokan.cz
Wed Jan 7 02:52:52 EST 2009
the problem is related to the default behavior of GDAL warping core,
which sometimes does not have enough input pixels or has a problem to
calculate correct target extent.
What you can do is to warp your input data into EPSG:900913 by
gdalwarp utility before tiling by gdal2tiles utility.
GDAL2Tiles will not warp the input again, so you have all the warping
totally under your control in such case.
Typically you should use a command like:
gdalwarp -of vrt -t_srs epsg:900913 -wo SOURCE_EXTRA=120 input.tif output.vrt
The trick is to use correct SOURCE_EXTRA value, which is documented here:
I realized that for images which are going out of the bounds of
Spherical Meractor it is better to specify also the cropping bounds,
gdalwarp -t_srs epsg:900913 -te -20037508.34 -20037508.34 20037508.34
20037508.34 -wo SOURCE_EXTRA=120 small_world.tif
BTW For anybody interested in seeing the tile bounds of Spherical
Meracator Tiles (Google Maps, etc.) I created a simple mashup with the
documentation. Tile bounds appear when you click the map:
It would be nice to have an algorithm for calculating how many input
pixels are missing (so how big the SOURCE_EXTRA value should be) -
probably with help of Proj4/OGR.
I can then automatically add such calculated value to the internal
warping functionality of GDAL2Tiles (in the postprocessing of VRT file
which is coming from AutoCreateWarpedVRT function).
FrankW or anybody else: any tips?
More clean of course would be to have it correctly set by default in
the C++ warping core, so the gaps does not appear at all (it appears
also on the command line with gdalwarp utility). But I guess it is
quite problematic to make an general algorithm.
I have found a patch trying to solve this issue for some polar
Is there any progress in this direction?
The discussion between me and Frank related to this is archived here:
On Wed, Jan 7, 2009 at 12:33 AM, Roger André <randre at gmail.com> wrote:
> I've gotten the map tile output from gdal2tiles.py to work properly with
> Tilecache and the results look pretty good. However, I'm seeing a fairly
> large gap in data at the international dateline. I recall seeing some
> discussion about this between Frank and Klokan on the list previously, and
> recompiled gdal after editing gdal/alg/gdalwarpoperation.cpp and adding a
> larger size to the sampling edge buffer. This doesn't seem to have helped
> Is it possible to create a global tileset with gdal2tiles.py without having
> a gap at the dateline?
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
More information about the gdal-dev