[gdal-dev] Results of gdalwarp from UTM32 to EPSG:4326 are not aligned?
Even Rouault
even.rouault at spatialys.com
Tue May 12 09:12:34 PDT 2020
On mardi 12 mai 2020 16:19:43 CEST Pham Huu Bang wrote:
> Hello,
>
> I've a Sentinel 2 UTM32 scene (JPEG2000 format).
>
> What I want to do is:
>
> + Warp this scene from UTM32 to EPSG:4326 by gdalwarp
> gdalwarp T32UQD_20200421T102021_TCI_60m.jp2 -t_srs EPSG:4326 full_warp.tif
>
> + Clip a small subset of this file by gdal_translate
> gdal_translate -projwin 798326.68347 5795956.80269 799609.577326
> 5794397.95642 T32UQD_20200421T102021_TCI_60m.jp2 crop.tif
>
> Then warp this small subset also from UTM32 to EPSG:4326 by gdalwarp:
>
> gdalwarp crop.tif -t_srs EPSG:4326 small_warp.tif -dstnodata 0
>
> However, when I overlay the small_warp.tif on the full_warp.tif by
> QGIS 2.14.9, I see the small file is not aligned on the big one.
>
> Illustration: https://i.stack.imgur.com/U5Vql.png
>
> What can be the reason for it?
When you don't specify any target extent or resolution, gdalwarp guesses them from the
input raster georeferencing and target SRS. It doesn't try to align on any particular resolution
You may want to use the -tr and -tap switches to specify a target resolution, and constraint
the extents to be aligned on it.
Another reason for the misalignment is that you use the default nearest resampling. Using -r
cubic could likely improve things
To get perfectly overlapping images, you may also need to specify -et 0
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200512/2f5f49f3/attachment.html>
More information about the gdal-dev
mailing list