Opened 7 years ago

Closed 7 years ago

#5572 closed defect (fixed)

NITF HISTOA TRE not correctly parsed

Reported by: bradh Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: default Version: unspecified
Severity: normal Keywords: NITF
Cc:

Description (last modified by bradh)

The image chip example (digitalglobe_ncdrd_chip.ntf) in the Classic Tutorial data available from http://www.exelisvis.com/Learn/Resources/Tutorials/TabId/405/PageID/4/PgrID/1742/Default.aspx (unfortunately individual file is not redistributable, and 2Gbytes of data to download the whole lot, although there are a lot of other interesting files in the download) does not parse correctly (see below, some standard stuff omitted to show the issue more clearly).

$ gdalinfo -mdd xml:TRE testdata/digitalglobe_ncdrd_chip.ntf Driver: NITF/National Imagery Transmission Format Files: testdata/digitalglobe_ncdrd_chip.ntf Size is 3000, 3000 Coordinate System is: ....

NITF_USE00A_SUN_EL=+48.2

Warning 1: Not enough bytes when reading HISTOA TRE (at least 198 needed, only 197 available) Metadata (xml:TRE): <tres> ...

<tre name="HISTOA" location="image">

<field name="SYSTYPE" value="QB02GA" /> <field name="PC" value="NONE00000000" /> <field name="PE" value="GEOR" /> <field name="REMAP_FLAG" value="" /> <field name="LUTID" value="00" /> <field name="NEVENTS" value="02" /> <repeated name="EVENT" number="2">

<group index="0">

<field name="PDATE" value="20070627192436" /> <field name="PSITE" value="DG" /> <field name="PAS" value="N001090905" /> <field name="NIPCOM" value="0" /> <field name="IBPP" value="11" /> <field name="IPVTYPE" value="INT" /> <field name="INBWC" value="NONE000000" /> <field name="DISP_FLAG" value="" /> <field name="ROT_FLAG" value="1" /> <field name="ROT_ANGLE" value="000.2556" /> <field name="PROJ_FLAG" value="" /> <field name="ASYM_FLAG" value="1" /> <field name="ZOOMROW" value="0000011" /> <field name="ZOOMCOL" value="INTNONE" /> <field name="SHARP_FLAG" value="0" /> <field name="MAG_FLAG" value="0" /> <field name="DRA_FLAG" value="0" /> <field name="TTC_FLAG" value="0" /> <field name="DEVLUT_FLAG" value="0" /> <field name="OBPP" value="02" /> <field name="OPVTYPE" value="007" /> <field name="OUTBWC" value="0702150054" />

</group> <group index="1">

<field name="PDATE" value="ITT VIS ENVI" /> <field name="PSITE" value=" 4.4 011I" /> <field name="PAS" value="NTNONE0000" /> <field name="NIPCOM" value="0" /> <field name="IBPP" value="0" /> <field name="IPVTYPE" value="000" /> <field name="INBWC" value="0000011INT" /> <field name="DISP_FLAG" value="N" /> <field name="ROT_FLAG" value="O" /> <field name="PROJ_FLAG" value="N" /> <field name="ASYM_FLAG" value="E" /> <field name="SHARP_FLAG" value="0" /> <field name="MAG_FLAG" value="0" /> <field name="DRA_FLAG" value="0" /> <field name="TTC_FLAG" value="0" /> <field name="DEVLUT_FLAG" value="0" />

</group>

</repeated>

</tre>

...

I also have a GeoEye? (OrbView?) example that fails to parse - unfortunately not public.

http://www.nato.int/structur/ac/224/standard/4545/4545_documents/HISTO%20Support%20Data%20Extension.pdf shows two different orders for the fields in HISTOA. Table 3 shows PROJ_FLAG before ASYM_FLAG (and the associated ZOOM fields), while Table 4 shows it after.

STDI-0002 (App L page 14) and STDI-0006 (Page 57) show ASYM_FLAG and the associated zoom before PROJ_FLAG.

Applying that change to the code:

--- a/gdal/data/nitf_spec.xml
+++ b/gdal/data/nitf_spec.xml
@@ -290,12 +290,12 @@
             <if cond="ROT_FLAG=1">
                 <field name="ROT_ANGLE" length="8"/>
             </if>
-            <field name="PROJ_FLAG" length="1"/>
             <field name="ASYM_FLAG" length="1"/>
             <if cond="ASYM_FLAG=1">
                 <field name="ZOOMROW" length="7"/>
                 <field name="ZOOMCOL" length="7"/>
             </if>
+            <field name="PROJ_FLAG" length="1"/>
             <field name="SHARP_FLAG" length="1"/>
             <if cond="SHARP_FLAG=1">
                 <field name="SHARPFAM" length="2"/>


We now get:

$ gdalinfo -mdd xml:TRE testdata/digitalglobe_ncdrd_chip.ntf Driver: NITF/National Imagery Transmission Format Files: testdata/digitalglobe_ncdrd_chip.ntf Size is 3000, 3000 Coordinate System is: ...

NITF_USE00A_SUN_EL=+48.2

Metadata (xml:TRE): <tres> ...

<tre name="HISTOA" location="image">

<field name="SYSTYPE" value="QB02GA" /> <field name="PC" value="NONE00000000" /> <field name="PE" value="GEOR" /> <field name="REMAP_FLAG" value="" /> <field name="LUTID" value="00" /> <field name="NEVENTS" value="02" /> <repeated name="EVENT" number="2">

<group index="0">

<field name="PDATE" value="20070627192436" /> <field name="PSITE" value="DG" /> <field name="PAS" value="N001090905" /> <field name="NIPCOM" value="0" /> <field name="IBPP" value="11" /> <field name="IPVTYPE" value="INT" /> <field name="INBWC" value="NONE000000" /> <field name="DISP_FLAG" value="" /> <field name="ROT_FLAG" value="1" /> <field name="ROT_ANGLE" value="000.2556" /> <field name="ASYM_FLAG" value="" /> <field name="PROJ_FLAG" value="1" /> <field name="SHARP_FLAG" value="0" /> <field name="MAG_FLAG" value="0" /> <field name="DRA_FLAG" value="0" /> <field name="TTC_FLAG" value="0" /> <field name="DEVLUT_FLAG" value="0" /> <field name="OBPP" value="11" /> <field name="OPVTYPE" value="INT" /> <field name="OUTBWC" value="NONE000000" />

</group> <group index="1">

<field name="PDATE" value="20070702150054" /> <field name="PSITE" value="ITT VIS" /> <field name="PAS" value="ENVI 4.4" /> <field name="NIPCOM" value="0" /> <field name="IBPP" value="11" /> <field name="IPVTYPE" value="INT" /> <field name="INBWC" value="NONE000000" /> <field name="DISP_FLAG" value="" /> <field name="ROT_FLAG" value="0" /> <field name="ASYM_FLAG" value="0" /> <field name="PROJ_FLAG" value="0" /> <field name="SHARP_FLAG" value="0" /> <field name="MAG_FLAG" value="0" /> <field name="DRA_FLAG" value="0" /> <field name="TTC_FLAG" value="0" /> <field name="DEVLUT_FLAG" value="0" /> <field name="OBPP" value="11" /> <field name="OPVTYPE" value="INT" /> <field name="OUTBWC" value="NONE000000" />

</group>

</repeated>

</tre>

...

Attachments (1)

nitf_HISTOA_2014-07-15.diff (736 bytes) - added by bradh 7 years ago.
Patch containing NITF XML fix

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by bradh

Attachment: nitf_HISTOA_2014-07-15.diff added

Patch containing NITF XML fix

comment:1 Changed 7 years ago by bradh

Description: modified (diff)

comment:2 Changed 7 years ago by Even Rouault

Milestone: 1.11.1
Resolution: fixed
Status: newclosed

trunk r27535, branches/1.11 r27536 "NITF HISTOA TRE: put definition of TRE in conformance with STDI-0002 (App L page 14) and STDI-0006 (Page 57) (patch by bradh, #5572)"

Note: See TracTickets for help on using tickets.