nrhode nrhode - 25 days ago 9
Python Question

gdal2tiles pixel shift in output tiles

I would like to re-calculate large geotiff files (10,000 x 10,000px) with the help of gdal2tiles into little (256 x 256px) tiles. The process works fine. However, the result is not perfect. There is a slight shift in the tiles (see the picture below). I've already tried different resampling methods and get the same result every time.

Here is my statement:

Gdal2tiles.py -s EPSG: 25832 -z 11-20 /home/input/file.tif output_path /


Does anyone have any ideas?

enter image description here

Answer

After days of research I found an answer by myself:

The problem depends on the transformation of the srs from EPSG:25832 to EPSG:3857.

What I did: I created one big .tif with gdalwarp and used the paramter -s_srs EPSG:25832 and -t_srs EPSG:3857 (!important is to create one big file - otherwise there will be a gap between the .tif files). I also had to take the parameter -r cubic . With the default option (-r average) I got the same problem.

So it was really tricky, but worked for me!