[gdal-dev] Merging TIFF files creates offset / deformation

Hotmail rlelamer at hotmail.fr
Wed Apr 7 10:50:24 PDT 2021


Hi,

I have a PNG library (524288 tiles of 256px * 256px) which I georeferenced via GDAL.

# This first part works correctly.
•  ullr:

> ulx = (360 * (column / 1024)) - 180
> uly = 90 - (180 * (line / 512))
> lrx = ulx + 0.3515625
> lry = uly - 0.3515625
> ULLR = ulx + '' + uly + '' + lrx + '' + lry

> gdal_translate -of VRT -a_srs EPSG:4326 -co NBITS=1 Path/Of/Input.png Path/Of/Output.vrt -a_ullr + ULLR
>
> gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co NBITS=1 Path/Of/Input.vrt Path/Of/Output.tiff

# The second part works correctly too
I merge the tiles of a row (1024 TIFF tiles) using a VRT then from it I create the TIFF file

> #!/bin/bash
>
> for i in `seq 0 1 511`;
> do
>         gdalbuildvrt Path/Of/lines_vrt/map_$i.vrt Path/Of/tiff/map_11_*_$i.tiff
>         gdal_translate -co NBITS=1 Path/Of/lines_vrt/map_$i.vrt Path/Of/lines_tiff/map_$i.tiff
> done

Here if I use gdal_merge.py, either I get an invalid file (1.xMo while the lines are approx 60Mo) or I observe a offset / deformation ... (In QGIS)

# The last part doesn't work properly (and I don't know why ...)
Here I am merging all the lines (TIFF files) into a global TIFF file using the same method as before. (with a list.txt file)

> #!/bin/bash
>
> gdalbuildvrt -input_file_list Path/Of/lines_tiff/list.txt Path/Of/global_vrt/map_global.vrt
> gdal_translate -co NBITS=1 Path/Of/global_vrt/map_global.vrt Path/Of/map_global.tiff

and I observe a offset / deformation. (In QGIS again)

I wonder what am I doing that is wrong

My final goal is to use the global file (TIFF) with gdal2tiles.py (Tiles overlay on GMaps / OSM)

Thanks


More information about the gdal-dev mailing list