I'm trying to implement an open-source NITF reader (using only java, no external libraries such as GDAL or NITRO), and its mostly going OK. However I'm having trouble understanding the RPF extensions, in particular the attributes in the RPFDES TRE.
I know that they are documented in MIL-STD-2411-2, and I've read that and the main references (MIL-STD-2411 and MIL-STD-2411-1). I still don't understand how to parse it out though.
As a concrete example, http://download.osgeo.org/gdal/data/nitf/bugs/bug3337.ntf (which is NITF 2.0) has the RPFDES TRE looking like:
01efe0 20 02 00 20 02 00 20 02 00 20 02 44 45 52 65 67 > .. .. .. .DEReg<
01eff0 69 73 74 65 72 65 64 20 45 78 74 65 6e 73 69 6f >istered Extensio<
01f000 6e 73 20 20 20 20 30 31 55 20 20 20 20 20 20 20 >ns 01U <
01f010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 > <
*
01f0a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 55 > U<
01f0b0 44 49 44 20 20 30 30 31 30 30 30 30 52 50 46 44 >DID 0010000RPFD<
01f0c0 45 53 30 30 36 32 31 00 21 00 02 00 00 00 00 00 >ES00621.!.......<
01f0d0 08 00 01 01 00 00 00 01 08 00 02 01 00 00 00 01 >................<
01f0e0 10 00 03 01 02 00 00 01 18 00 04 01 02 00 00 01 >................<
01f0f0 20 00 04 02 02 00 00 01 2a 00 04 03 02 00 00 01 > .......*.......<
01f100 32 00 04 04 02 00 00 01 36 00 05 01 02 00 00 01 >2.......6.......<
01f110 3d 00 05 02 02 00 00 01 3f 00 05 03 02 00 00 01 >=.......?.......<
01f120 43 00 05 04 02 00 00 01 47 00 06 01 01 00 00 01 >C.......G.......<
01f130 4b 00 07 01 01 00 00 01 4f 00 08 02 01 00 00 01 >K.......O.......<
01f140 53 00 09 02 01 00 00 01 55 00 0a 02 01 00 00 01 >S.......U.......<
01f150 57 00 0b 02 01 00 00 01 59 00 0c 01 02 00 00 01 >W.......Y.......<
01f160 5b 00 0e 01 02 00 00 01 5e 00 10 01 02 00 00 01 >[.......^.......<
01f170 60 00 10 02 02 00 00 01 64 00 11 01 02 00 00 01 >`.......d.......<
01f180 66 00 11 02 02 00 00 01 6a 00 12 01 02 00 00 01 >f.......j.......<
01f190 6c 00 12 02 02 00 00 01 70 00 13 01 02 00 00 01 >l.......p.......<
01f1a0 72 00 13 02 02 00 00 01 76 00 14 01 02 00 00 01 >r.......v.......<
01f1b0 78 00 14 02 02 00 00 01 80 00 14 03 02 00 00 01 >x...............<
01f1c0 82 00 14 04 02 00 00 01 8a 00 19 01 02 00 00 01 >................<
01f1d0 92 00 19 02 02 00 00 01 94 31 39 38 34 30 33 31 >.........1984031<
01f1e0 30 32 30 30 31 31 30 31 32 31 39 38 34 30 33 31 >0200110121984031<
01f1f0 30 47 4e 43 20 20 20 20 20 20 20 30 31 20 20 20 >0GNC 01 <
01f200 20 20 20 55 4e 44 20 20 20 20 20 20 20 37 54 43 > UND 7TC<
01f210 00 00 00 00 40 40 00 00 3f 7f e5 c9 4d 53 4c 20 >....@@..?...MSL <
01f220 57 47 45 00 00 00 00 00 00 00 00 00 49 4e 54 75 >WGE.........INTu<
01f230 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >d...............<
01f240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................<
*
01f260 00 00 00 00 00 00 00 00 00 00 08 00 52 00 10 00 >............R...<
01f270 05 40 52 f6 db ba 46 e8 05 c0 60 e0 00 00 00 00 >[email protected]...`.....<
01f280 00 40 52 f6 db ba 46 e8 05 c0 60 e0 00 00 00 00 >[email protected]...`.....<
01f290 00 40 52 f6 db ba 46 e8 05 40 46 80 00 00 00 00 >[email protected]..@F.....<
*
01f2b0 00 40 52 f6 db ba 46 e8 05 c0 60 e0 00 00 00 00 >[email protected]...`.....<
01f2c0 00 00 05 40 56 80 00 00 00 00 00 c0 66 80 00 00 >[email protected]...<
01f2d0 00 00 00 40 56 80 00 00 00 00 00 40 66 80 00 00 >...@V......@f...<
01f2e0 00 00 00 40 50 ff f6 ab 93 ae fe 40 66 80 00 00 >...@P......@f...<
01f2f0 00 00 00 40 50 ff f6 ab 93 ae fe c0 66 80 00 00 >[email protected]...<
01f300 00 00 00 40 56 80 00 00 00 00 00 c0 66 80 00 00 >[email protected]...<
01f310 00 00 00 00 00 00 08 00 01 00 19 30 30 30 30 30 >...........00000<
01f320 30 32 33 2e 47 4e 39 30 30 30 30 30 30 31 33 2e >023.GN900000013.<
01f330 47 4e 39 33 >GN93<
01f334
I'm OK with the parts up and including the RPFDES tag name and length. After 01f0c7, I'm lost.
From using GDAL, I can see that there are some dates starting at 0x01f1d9, and some other things that are probably the CRS and elevation references, but I'm mystified as to how I'm meant to extract them. I have no problem actually reading data in java (I've got most of NITF implemented), just don't understand which data I need to read. Can someone explain the data structure parsing to get to the first date, or at least provide some additional guidance on how I'm meant to use MIL-STD-2411-2 to work it out?
For those wondering why it has to be only java - its a deployment thing for OSGI. For those wondering where the source code is, see https://github.com/codice/imaging-nitf.