Changeset 12389

Show
Ignore:
Timestamp:
10/12/07 21:47:54 (10 months ago)
Author:
warmerdam
Message:

Fix handling of gmljp2 files with srsName only on Envelope (#1906)
Fix handling of urn:x-ogc (use importFromURN() method).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/gdal/gcore/gdaljp2metadata.cpp

    r10646 r12389  
    629629 
    630630/* -------------------------------------------------------------------- */ 
     631/*      If we still don't have an srsName, check for it on the          */ 
     632/*      boundedBy Envelope.  Some products                              */ 
     633/*      (ie. EuropeRasterTile23.jpx) use this as the only srsName       */ 
     634/*      delivery vehicle.                                               */ 
     635/* -------------------------------------------------------------------- */ 
     636    if( pszSRSName == NULL ) 
     637    { 
     638        pszSRSName =  
     639            CPLGetXMLValue( psXML, 
     640                            "=FeatureCollection.boundedBy.Envelope.srsName", 
     641                            NULL ); 
     642    } 
     643 
     644/* -------------------------------------------------------------------- */ 
    631645/*      If we have gotten a geotransform, then try to interprete the    */ 
    632646/*      srsName.                                                        */ 
     
    635649        && (pszProjection == NULL || strlen(pszProjection) == 0) ) 
    636650    { 
     651        OGRSpatialReference oSRS; 
     652 
    637653        if( EQUALN(pszSRSName,"epsg:",5) ) 
    638654        { 
    639             OGRSpatialReference oSRS; 
    640655            if( oSRS.SetFromUserInput( pszSRSName ) == OGRERR_NONE ) 
    641656                oSRS.exportToWkt( &pszProjection ); 
    642657        } 
    643         else if( EQUALN(pszSRSName,"urn:ogc:def:crs:EPSG::",22) ) 
    644         { 
    645             OGRSpatialReference oSRS; 
    646             if( oSRS.importFromEPSG( atoi(pszSRSName + 22) ) == OGRERR_NONE ) 
    647                 oSRS.exportToWkt( &pszProjection ); 
    648         } 
    649         else if( EQUALN(pszSRSName,"urn:ogc:def:crs:EPSG:",21) ) 
    650         { 
    651             const char *pszCode = pszSRSName+21; 
    652             while( *pszCode != ':' && *pszCode != '\0' ) 
    653                 pszCode++; 
    654  
    655             OGRSpatialReference oSRS; 
    656             if( oSRS.importFromEPSG( atoi(pszCode+1) ) == OGRERR_NONE ) 
    657                 oSRS.exportToWkt( &pszProjection ); 
     658        else if( EQUALN(pszSRSName,"urn:",4)  
     659                 && strstr(pszSRSName,":def:") != NULL 
     660                 && oSRS.importFromURN(pszSRSName) == OGRERR_NONE ) 
     661        { 
     662            oSRS.exportToWkt( &pszProjection ); 
    658663        } 
    659664        else if( !GMLSRSLookup( pszSRSName ) )