[gdal-dev] Extending nitf_spec.xml

Brad Hards bradh at frogmouth.net
Tue Dec 8 01:49:57 PST 2015


Hi,

I use the GDAL nitf_spec.xml file 
(https://trac.osgeo.org/gdal/browser/trunk/gdal/data/nitf_spec.xml) in an open
source project (Java library: https://github.com/codice/imaging-nitf). I'm
trying to figure out how to extend my library to support writing as well as
reading. I try to keep the file the same (better for everyone, really).

In writing the NITF file out, I'm trying for binary identical to what I read
in.

I've come across a problem that might require some changes to the
nitf_spec.xml file, and would like to check that its OK before proposing a
patch.

The problem case is that some TREs have reserved fields. As an example,
consider BLOCKA:
 
   <tre name="BLOCKA" length="123" location="image">
        <field name="BLOCK_INSTANCE" length="2" type="integer" minval="1" maxval="99"/>
        <field name="N_GRAY" length="5" type="integer" minval="0" maxval="99999"/>
        <field name="L_LINES" length="5" type="integer" minval="1" maxval="99999"/>
        <field name="LAYOVER_ANGLE" length="3" type="integer" minval="0" maxval="359" unit="degrees"/>
        <field name="SHADOW_ANGLE" length="3" type="integer" minval="0" maxval="359" unit="degrees"/>
        <field length="16"/>
        <field name="FRLC_LOC" length="21"/>
        <field name="LRLC_LOC" length="21"/>
        <field name="LRFC_LOC" length="21"/>
        <field name="FRFC_LOC" length="21"/>
        <field length="5"/>
    </tre>

The problem is those two reserved fields (16 spaces in between the end of
SHADOW_ANGLE and the start of FRLC_LOC; plus the 5 characters at the end).

I'd like to be able to write out the correct content for those, even if the TRE is
newly created.

There is already an attribute in the schema that could store them (so no
changes to the  nitf_spec.xsd). It would just look like:
   <tre name="BLOCKA" length="123" location="image">
        <field name="BLOCK_INSTANCE" length="2" type="integer" minval="1" maxval="99"/>
        <field name="N_GRAY" length="5" type="integer" minval="0" maxval="99999"/>
        <field name="L_LINES" length="5" type="integer" minval="1" maxval="99999"/>
        <field name="LAYOVER_ANGLE" length="3" type="integer" minval="0" maxval="359" unit="degrees"/>
        <field name="SHADOW_ANGLE" length="3" type="integer" minval="0" maxval="359" unit="degrees"/>
        <field length="16" fixed_value="                "/>
        <field name="FRLC_LOC" length="21"/>
        <field name="LRLC_LOC" length="21"/>
        <field name="LRFC_LOC" length="21"/>
        <field name="FRFC_LOC" length="21"/>
        <field length="5" fixed_value="010.0"/>
    </tre>

Any conceptual objections, pending a patch to that file? At this stage I believe
that would only affect BLOCKA, CSPROA, STDIDC and USE00A.

Note: I'm not proposing modifying gdal to actually use that fixed value, and
I believe that it would be ignored for GDAL. I'm mainly worried about other
users.

Brad


More information about the gdal-dev mailing list