Ticket #2475 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

NITF: adding BLOCKA TRE precludes writing IGEOLO

Reported by: janwas Owned by: rouault
Priority: normal Milestone: 1.5.3
Component: default Version: 1.5.2
Severity: normal Keywords: nitf ICORDS D
Cc:

Description

First of all, many thanks for GDAL! I've encountered an issue with the NITF driver in 1.5.2 and hope to be able to help.

Desired use case: generate an NITF/NSIF with geoinformation and load it in both ERDAS and GDAL-enabled apps. The BLOCKA TRE is needed because it allows higher resolution coordinates than the standard IGEOLO header field.

Problem: creating a BLOCKA by means of options passed to driver->Create causes ICORDS to be set to 'D', which is not supported when writing IGEOLO. A dataset->SetGeoTransform immediately after driver->Create and dataset->SetProjection therefore fails.

How to duplicate: see attached file test.cpp

Analysis: the final part of GDALCreate calls GDALOpen, which ends up invoking NITFReadBLOCKA_GCPs. The "GCPs" are actually image corners and are read from BLOCKA, after which the image ICORDS value is changed from G to D. This is accompanied by the comment:

Regardless of the former value of ICORDS, the values are now in decimal degrees.

The rationale for this is unclear. The existence of BLOCKA should not change the formatting of the IGEOLO coordinates, i.e. ICORDS. Calling dataset->SetGeoTransform results in failure inside NITFWriteIGEOLO because it currently requires ICORDS to be one of {G,N,S}. A nice way to fix this would be to add support for 'D', i.e. decimal degree coordinates, which is required by STANAG 4545 anyway.

Proposed code for formatting such lat-lon pairs follows:

	sprintf(buf, "%+#07.3f%+#08.3f", lat, lon);
	assert(strlen(buf) == 15);

Is there any other useful information I can provide?

Attachments

test.cpp Download (6.5 KB) - added by janwas 5 years ago.

Change History

Changed 5 years ago by janwas

Changed 5 years ago by rouault

  • keywords nitf ICORDS D added
  • owner changed from warmerdam to rouault
  • status changed from new to assigned
  • severity changed from major to normal

Changed 5 years ago by rouault

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to 1.5.3

Fixed in trunk in r14928, in branches/1.5 in r14929. Tested in trunk in r14930

Note: See TracTickets for help on using tickets.