[gdal-dev] Results of gdalwarp from UTM32 to EPSG:4326 are not aligned?
Pham Huu Bang
a09550 at gmail.com
Tue May 12 09:32:14 PDT 2020
Thanks Even,
I managed to make them aligned (illustration:
https://i.imgur.com/1TwmVMN.png) from your valuable suggestion with these 2
commands (-tr are used same for both gdapwarp and -tap option is the
critical):
gdalwarp -tr 0.0007161230037719291 -0.0007161230037719291
T32UQD_20200421T102021_TCI_60m.jp2 full_warp.tif -t_srs EPSG:4326
-dstnodata 0 -tap
gdalwarp -tr 0.0007161230037719291 -0.0007161230037719291 crop.tif
small_warp.tif -t_srs EPSG:4326 -dstnodata 0 -tap
On Tue, 12 May 2020 at 18:12, Even Rouault <even.rouault at spatialys.com>
wrote:
> 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
>
--
*Bang Pham Huu *
*-------------------------------------------------------------------------------------*
*Master of Science - Research Assistant at Field Monitoring Center - 4 F,
E3 BuildingViet Nam - Ha Noi National University - University of
Engineering and Technology*
*Email: a09550 at gmail.com <a09550 at gmail.com> - Tel: +84 164.6339.217*
*“Life is like riding a bicycle. To keep your balance, you must keep
moving.”― Albert Einstein*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200512/ce92552c/attachment.html>
More information about the gdal-dev
mailing list