Opened 11 years ago

Closed 11 years ago

#2475 closed defect (fixed)

NITF: adding BLOCKA TRE precludes writing IGEOLO

Reported by: janwas Owned by: Even 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 (1)

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

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by janwas

Attachment: test.cpp added

comment:1 Changed 11 years ago by Even Rouault

Keywords: nitf ICORDS D added
Owner: changed from warmerdam to Even Rouault
Severity: majornormal
Status: newassigned

comment:2 Changed 11 years ago by Even Rouault

Milestone: 1.5.3
Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.