Changeset 19321


Ignore:
Timestamp:
Apr 5, 2010 12:08:59 PM (6 years ago)
Author:
rouault
Message:

NITF: test reading TRE from DE segment; test using NITF header located in STREAMING_FILE_HEADER DE segment

Location:
trunk/autotest/gdrivers
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autotest/gdrivers/nitf.py

    r19314 r19321  
    16221622            print(gt)
    16231623            return 'fail'
     1624
     1625    return 'success'
     1626
     1627###############################################################################
     1628# Test reading TRE from DE segment
     1629
     1630def nitf_61():
     1631
     1632    # Derived from http://www.gwg.nga.mil/ntb/baseline/software/testfile/rsm/SampleFiles/FrameSet1/NITF_Files/i_6130a.zip
     1633    # but hand edited to have just 1x1 imagery
     1634    ds = gdal.Open('data/i_6130a_truncated.ntf')
     1635    md = ds.GetMetadata('TRE')
     1636    ds = None
     1637
     1638    if md is None or 'RSMDCA' not in md or 'RSMECA' not in md or 'RSMPCA' not in md or 'RSMIDA' not in md:
     1639        print(md)
     1640        return 'fail'
    16241641
    16251642    return 'success'
     
    21992216       or md['NITF_RPF_SignificantDate'] != '19850305':
    22002217        gdaltest.post_reason( 'RPF attribute metadata not captured (#3413)')
     2218        return 'fail'
     2219
     2220    return 'success'
     2221
     2222###############################################################################
     2223# Check that we can read NITF header located in STREAMING_FILE_HEADER DE
     2224# segment when header at beginning of file is incomplete
     2225
     2226def nitf_online_21():
     2227
     2228    if not gdaltest.download_file('http://www.gwg.nga.mil/ntb/baseline/software/testfile/Nitfv2_1/ns3321a.nsf', 'ns3321a.nsf'):
     2229        return 'skip'
     2230
     2231    ds = gdal.Open( 'tmp/cache/ns3321a.nsf' )
     2232    md = ds.GetMetadata()
     2233    ds = None
     2234
     2235    # If we get NS3321A, it means we are not exploiting the header from the STREAMING_FILE_HEADER DE segment
     2236    if md['NITF_OSTAID'] != 'I_3321A':
     2237        gdaltest.post_reason('did not get expected OSTAID value')
     2238        print(md['NITF_OSTAID'])
    22012239        return 'fail'
    22022240
     
    24112449    nitf_59,
    24122450    nitf_60,
     2451    nitf_61,
    24132452    nitf_online_1,
    24142453    nitf_online_2,
     
    24402479    nitf_online_19,
    24412480    nitf_online_20,
     2481    nitf_online_21,
    24422482    nitf_cleanup ]
    24432483
Note: See TracChangeset for help on using the changeset viewer.