Changeset 13795

Show
Ignore:
Timestamp:
02/16/08 00:04:07 (5 months ago)
Author:
warmerdam
Message:

fix problems with old/new state plane zone codes (#2227)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/raw/envidataset.cpp

    r13740 r13795  
    183183 
    184184/************************************************************************/ 
    185 /*                           ESRIToUSGSZone()                           */ 
     185/*                           ITTVISToUSGSZone()                         */ 
    186186/*                                                                      */ 
    187 /*      Convert ESRI style state plane zones to USGS style state        */ 
    188 /*      plane zones.                                                    */ 
    189 /************************************************************************/ 
    190  
    191 static int ESRIToUSGSZone( int nESRIZone ) 
     187/*      Convert ITTVIS style state plane zones to NOS style state       */ 
     188/*      plane zones.  The ENVI default is to use the new NOS zones,     */ 
     189/*      but the old state plane zones can be used.  Handle this.        */  
     190/************************************************************************/ 
     191 
     192static int ITTVISToUSGSZone( int nITTVISZone ) 
    192193 
    193194{ 
     
    195196    int         i; 
    196197     
     198        // Default is to use the zone as-is, as long as it is in the  
     199        // available list 
    197200    for( i = 0; i < nPairs; i++ ) 
    198201    { 
    199         if( anUsgsEsriZones[i*2+1] == nESRIZone ) 
     202        if( anUsgsEsriZones[i*2] == nITTVISZone ) 
    200203            return anUsgsEsriZones[i*2]; 
    201204    } 
    202205 
    203     return nESRIZone; // perhaps it *is* the USGS zone? 
     206        // If not found in the new style, see if it is present in the 
     207        // old style list and convert it.  We don't expect to see this 
     208        // often, but older files allowed it and may still exist. 
     209    for( i = 0; i < nPairs; i++ ) 
     210    { 
     211        if( anUsgsEsriZones[i*2+1] == nITTVISZone ) 
     212            return anUsgsEsriZones[i*2]; 
     213    } 
     214 
     215    return nITTVISZone; // perhaps it *is* the USGS zone? 
    204216} 
    205217 
     
    10711083             && nCount >= 7 ) 
    10721084    { 
    1073         oSRS.SetStatePlane( ESRIToUSGSZone(atoi(papszFields[7])), FALSE ); 
     1085        oSRS.SetStatePlane( ITTVISToUSGSZone(atoi(papszFields[7])), FALSE ); 
    10741086    } 
    10751087    else if( EQUALN(papszFields[0],"State Plane (NAD 83)",19) 
    10761088             && nCount >= 7 ) 
    10771089    { 
    1078         oSRS.SetStatePlane( ESRIToUSGSZone(atoi(papszFields[7])), TRUE ); 
     1090        oSRS.SetStatePlane( ITTVISToUSGSZone(atoi(papszFields[7])), TRUE ); 
    10791091    } 
    10801092    else if( EQUALN(papszFields[0],"Geographic Lat",14)