Ticket #1750 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

[PATCH] Fixes bouding box for CADRG files crossing meridian 180°

Reported by: rouault Assigned to: rouault
Priority: normal Milestone: 1.4.3
Component: GDAL_Raster Version: 1.4.2
Severity: normal Keywords: CADRG nitf
Cc: warmerdam

Description

The attached patch fixes handling of some CADRG products whose bounding box crosses meridian 180°. This is the case for cjnc/cjncz01/000k1023.jn1 (and similar) from NIMA 'GNCJNCN' CDROM (unfortunately, I can't attach it as its distribution is restricted)

Currently, gdalinfo reports :

Corner Coordinates:
Upper Left  ( 179.2515593,  33.2307692) (179d15'5.61"E, 33d13'50.77"N)
Lower Left  ( 179.2515593,  29.0769231) (179d15'5.61"E, 29d 4'36.92"N)
Upper Right (-176.2577963,  33.2307692) (176d15'28.07"W, 33d13'50.77"N)
Lower Right (-176.2577963,  29.0769231) (176d15'28.07"W, 29d 4'36.92"N)
Center      (   1.4968815,  31.1538462) (  1d29'48.77"E, 31d 9'13.85"N)

With this BB, the display in OpenEV is incorrect.

The patch just adds +360 to the right longitude when it detects that right longitude < left longitude. This leads to longitude > 180°, but apparently it's ok for OpenEV or gdalwarp (I've warped it successfully to UTM zone 60. EPSG:32660).

After applying the patch, gdalinfo reports :

Upper Left  ( 179.2515593,  33.2307692) (179d15'5.61"E, 33d13'50.77"N)
Lower Left  ( 179.2515593,  29.0769231) (179d15'5.61"E, 29d 4'36.92"N)
Upper Right (     183.742,      33.231) (183d44'31.93"E, 33d13'50.77"N)
Lower Right (     183.742,      29.077) (183d44'31.93"E, 29d 4'36.92"N)
Center      (     181.497,      31.154) (181d29'48.77"E, 31d 9'13.85"N)

Another solution that has come into my mind would be to truncate the right longitude to E180. (as there are no data, just blank, in these products at the right of E180). But we should modify the resolution of the image that is reported. Seemed a bit too complex.

Attachments

gdal_svn_cadrg_meridian180_bug1750.patch (1.0 kB) - added by rouault on 08/17/07 15:56:26.
001zc013_meridian180.on1 (286.7 kB) - added by rouault on 08/18/07 06:53:40.
Modified version of 001zc013.on1 whose bounding box is crossing merdian 180°

Change History

08/17/07 15:56:26 changed by rouault

  • attachment gdal_svn_cadrg_meridian180_bug1750.patch added.

08/18/07 06:52:24 changed by rouault

In order people being able to check the problem, I've forged a fake CADRG file, from 001zc013.on1, by just changing the left and right longitude of the LID_CoverageSectionSubheader section (no change made in the section with ASCII coordinates as their values are overriden by those of the LID_CoverageSectionSubheader section). The left and right longitude in this file are respectively 178.875E and 178.875W. Thus, you can observe the same behaviour as described above.

08/18/07 06:53:40 changed by rouault

  • attachment 001zc013_meridian180.on1 added.

Modified version of 001zc013.on1 whose bounding box is crossing merdian 180°

08/18/07 10:54:48 changed by warmerdam

  • keywords changed from CADRG to CADRG nitf.
  • milestone set to 1.4.3.

Even,

This change looks good. Please go ahead and apply in trunk, and branches/1.4.

08/18/07 10:55:37 changed by warmerdam

PS. please include the bug ticket # in the comments about the issue.

08/18/07 12:05:04 changed by rouault

  • status changed from new to closed.
  • resolution set to fixed.

Commited in trunk in r11904 and in branches/1.4 in r11905