Changeset 13569

Show
Ignore:
Timestamp:
01/22/08 15:19:46 (6 months ago)
Author:
warmerdam
Message:

update to include better axis testing (#2131)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/autotest/gdrivers/jp2kak.py

    r12387 r13569  
    126126############################################################################### 
    127127# Test reading GMLJP2 file with srsName only on the Envelope, and lots of other 
    128 # metadata junk 
     128# metadata junk.  This file is also handled currently with axis reordering 
     129# disabled.  
    129130 
    130131def jp2kak_6(): 
     
    133134        return 'skip' 
    134135 
     136    gdal.SetConfigOption( 'GDAL_IGNORE_AXIS_ORIENTATION', 'YES' ) 
     137     
    135138    exp_wkt = 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]' 
    136139 
     
    156159    ds = None 
    157160 
     161    gdal.SetConfigOption( 'GDAL_IGNORE_AXIS_ORIENTATION', 'NO' ) 
     162     
     163    return 'success' 
     164     
     165############################################################################### 
     166# Test reading a file with axis orientation set properly for an alternate 
     167# axis order coordinate system (urn:...:EPSG::4326).  
     168 
     169def jp2kak_7(): 
     170 
     171    if gdaltest.jp2kak_drv is None: 
     172        return 'skip' 
     173 
     174    exp_wkt = 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]' 
     175 
     176    ds = gdal.Open( 'data/gmljp2_dtedsm_epsg_4326_axes.jp2' ) 
     177    wkt = ds.GetProjection() 
     178 
     179    if wkt != exp_wkt: 
     180        gdaltest.post_reason( 'did not get expected WKT, should be WGS84' ) 
     181        print 'got: ', wkt 
     182        print 'exp: ', exp_wkt 
     183        return 'fail' 
     184 
     185    gt = ds.GetGeoTransform() 
     186    gte = (42.999583333333369,0.008271349862259,0, 
     187           34.000416666666631,0,-0.008271349862259) 
     188     
     189    if abs(gt[0] - gte[0]) > 0.0000001 or abs(gt[3] - gte[3]) > 0.000001 \ 
     190       or abs(gt[1] - gte[1]) > 0.000000000005 \ 
     191       or abs(gt[2] - gte[2]) > 0.000000000005 \ 
     192       or abs(gt[4] - gte[4]) > 0.000000000005 \ 
     193       or abs(gt[5] - gte[5]) > 0.000000000005: 
     194        gdaltest.post_reason( 'did not get expected geotransform' ) 
     195        print 'got: ', gt 
     196        return 'fail' 
     197        
     198    ds = None 
     199 
    158200    return 'success' 
    159201     
     
    173215    jp2kak_5, 
    174216    jp2kak_6, 
     217    jp2kak_7, 
    175218    jp2kak_cleanup ] 
    176219