Ticket #3206 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Part of the reprojected image is missing from GDAL 1.6.0 along 180E/180W longitude

Reported by: fengm Owned by: rouault
Priority: high Milestone: 1.6.3
Component: Utilities Version: 1.6.0
Severity: major Keywords: reprojection, gdalwarp
Cc: schannan@…, raghugeo@…, warmerdam

Description

Hi,

We have been trying to reproject several DEM images from Geograhpy CRS (with 90E as primary meridian instead of 0) to UTM 60N zone using GDALWARP command. The data spatial extent is crossing the 180W/180E longitude, and that is also the reason that we use Geography CRS with shifted primary meridian to avoid split the data into two ends of the coordinate system. The reprojection works perfectly fine with GDAL 1.5.4, but part of reprojected image are missing from GDAL 1.6.0. In the GDAL 1.6.0 outputs, we either get the part of the image that is west of 180 or east of 180 but never together as one product; i.e the output looks like its been "chopped" around the line which can be seen in the preview images.

Since GDAL 1.5.4 is working fine, we wonder if this is a bug in GDAL 1.6.0? BTW, we have also tried GDAL 1.6.2, and it gave same result as GDAL 1.6.0 did.

We have attached two preview images to show the difference between results from GDAL 1.5.4 and GDAL 1.6.0.

Attachments

from-gdal-1-5.png Download (74.6 KB) - added by fengm 2 years ago.
Reprojected image from GDAL 1.5. It gives the correct result.
from-gdal-1-6.png Download (68.7 KB) - added by fengm 2 years ago.
Reprojected image from GDAL 1.6, and the part that right to the 180E/180W longitude is missing in the image.
ticket_3206.patch Download (4.4 KB) - added by rouault 2 years ago.
Re-introduce InsertCenterLong?() in gdaltransformer.cpp

Change History

Changed 2 years ago by fengm

Reprojected image from GDAL 1.5. It gives the correct result.

Changed 2 years ago by fengm

Reprojected image from GDAL 1.6, and the part that right to the 180E/180W longitude is missing in the image.

Changed 2 years ago by rouault

Could you attach/provide a link to the source image and mention the exact gdalwarp commandline you tried ?

If you can't provide the source image, please attach at least the output of gdalinfo on it

Changed 2 years ago by fengm

Thanks for your quick response!

The command we were used is:


gdalwarp -s_srs "ESRI::GCS-WGS-90.prj" -t_srs "EPSG:32660" -tr 90 90 -srcnodata -32768 -dstnodata -32768 data_p092r14z60.nvi output.tif


You may download the GCS-WGS-90.prj at  ftp://ftp.umiacs.umd.edu/pub/mfeng/data/GCS-WGS-90.prj

and download the "dem_p092r14z60.nvi" (ENVI format) at  ftp://ftp.umiacs.umd.edu/pub/mfeng/data/data.zip

Changed 2 years ago by rouault

  • cc warmerdam added

Frank,

I've confirmed this is a regression introduced in 1.6 branch, in r14134, where the InsertCenterLong?() trick was disabled in gdalwarp.cpp. I'm not sure if it was just aimed at being temporarily disabled or for a more fundamental reason. I'm attaching a patch where I move InsertCenterLong?() in alg/gdaltransformer.cpp and call it from GDALCreateGenImgProjTransformer2(). This has the advantage of hiding this trick. Are you OK with this ?

Changed 2 years ago by rouault

Re-introduce InsertCenterLong?() in gdaltransformer.cpp

Changed 2 years ago by rouault

  • summary changed from Part of the reprojected image is missing from GDAL 1.6.0 along 180E/180W longitude to [PATCH] Part of the reprojected image is missing from GDAL 1.6.0 along 180E/180W longitude
  • milestone set to 1.7.0

Changed 2 years ago by warmerdam

  • owner changed from warmerdam to rouault

Even,

I've skimmed this a couple times and I can't see why I disabled the InsertCenterLong?() unless I thought this was something that the GDALCreateGenImgProjTransformer2 ought to be able to handle or something. I hate it when I don't write my thoughts down!

Anyways, I guess you might as well re-enable it, so go ahead with the patch.

Changed 2 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.7.0 to 1.6.3

Fix commited in trunk (r18014) and in branches/1.6 (r18015). Test added in r18016

Note: See TracTickets for help on using tickets.