Opened 12 years ago

Closed 12 years ago

#3206 closed defect (fixed)

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

Reported by: fengm Owned by: Even 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 (3)

from-gdal-1-5.png (74.6 KB) - added by fengm 12 years ago.
Reprojected image from GDAL 1.5. It gives the correct result.
from-gdal-1-6.png (68.7 KB) - added by fengm 12 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 (4.4 KB) - added by Even Rouault 12 years ago.
Re-introduce InsertCenterLong?() in gdaltransformer.cpp

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by fengm

Attachment: from-gdal-1-5.png added

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

Changed 12 years ago by fengm

Attachment: from-gdal-1-6.png added

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

comment:1 Changed 12 years ago by Even 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

comment:2 Changed 12 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

comment:3 Changed 12 years ago by Even 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 12 years ago by Even Rouault

Attachment: ticket_3206.patch added

Re-introduce InsertCenterLong?() in gdaltransformer.cpp

comment:4 Changed 12 years ago by Even Rouault

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

comment:5 Changed 12 years ago by warmerdam

Owner: changed from warmerdam to Even 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.

comment:6 Changed 12 years ago by Even Rouault

Milestone: 1.7.01.6.3
Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.