[gdal-dev] Overview Pixils don't line up.

Even Rouault even.rouault at spatialys.com
Tue Sep 19 14:34:29 PDT 2017


On mardi 19 septembre 2017 15:19:26 CEST Roarke Gaskill wrote:
> Hi,
> 
> I am seeing an issue where after I create an overview the pixels at the
> lower zoom_level are slightly shifted as compared to if I don't create an
> overview.
> 
> You can reproduce by running the following and comparing overview1.tif with
> overview2.tif.  They don't quite line up.  You will find overview1.tif and
> overview3.tif do line up.
> 
> https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_
> topo_8192.tif gdal_translate -a_srs EPSG:4326 -a_ullr -180 -90 180 90
> land_shallow_topo_8192.tif marble.tif
> 
> gdal_translate -of GPKG marble.tif marble.gpkg -co
> TILING_SCHEME=GoogleMapsCompatible
> gdal_translate -r nearest -of GTIFF -tr 156543.0339280410 156543.0339280410
>  marble.gpkg overview1.tif
> gdaladdo -r near  marble.gpkg
> gdal_translate -r nearest -of GTIFF -tr 156543.0339280410 156543.0339280410
>  marble.gpkg overview2.tif
> gdalwarp -r near -of GTIFF -tr 156543.0339280410 156543.0339280410
> marble.gpkg overview3.tif
> 
> 
> Why would the pixels shift because of the overview creation?

I could reproduce. The issue specifically comes from nearest resampling. My suspicion is that 
the choice of the source pixel for a target pixel is slightly different in the algorithm that does 
overview building than the one used by gdal_translate (that's not the same code)

If you use -r bilinear (or cubic, lanczos), you won't get this effect since all source pixels 
contributing to the target pixel are taken into account (and actually gdal_translate -r 
something_not_near uses the same code as overview building)

> 
> 
> Thanks,
> Roarke


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170919/fb8c4811/attachment.html>


More information about the gdal-dev mailing list