Skip to content

Commit

Permalink
First try with EPSG ID, then proj4 matching, when reading CRS from pr…
Browse files Browse the repository at this point in the history
…oject file

git-svn-id: http://svn.osgeo.org/qgis/trunk@11516 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Aug 26, 2009
1 parent 01b4c94 commit 3cbe7c3
Showing 1 changed file with 51 additions and 38 deletions.
89 changes: 51 additions & 38 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,60 +930,73 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )

if ( ! srsNode.isNull() )
{
QDomNode myNode = srsNode.namedItem( "proj4" );
QDomNode myNode = srsNode.namedItem( "epsg" );
QDomElement myElement = myNode.toElement();

if ( createFromProj4( myElement.text() ) )
if ( createFromEpsg( myElement.text().toLong() ) )
{
// createFromProj4() sets everything, inlcuding map units
QgsDebugMsg( "Setting from proj4 string" );
// createFromEpsg() sets everything, inlcuding map units
QgsDebugMsg( "Setting from EPSG id" );
}
else
{
QgsDebugMsg( "Setting from elements one by one" );
myNode = srsNode.namedItem( "proj4" );
myElement = myNode.toElement();

setProj4String( myElement.text() );
if ( createFromProj4( myElement.text() ) )
{
// createFromProj4() sets everything, inlcuding map units
QgsDebugMsg( "Setting from proj4 string" );
}
else
{
QgsDebugMsg( "Setting from elements one by one" );

myNode = srsNode.namedItem( "srsid" );
myElement = myNode.toElement();
setInternalId( myElement.text().toLong() );
myNode = srsNode.namedItem( "proj4" );
myElement = myNode.toElement();
setProj4String( myElement.text() );

myNode = srsNode.namedItem( "srid" );
myElement = myNode.toElement();
setSrid( myElement.text().toLong() );
myNode = srsNode.namedItem( "srsid" );
myElement = myNode.toElement();
setInternalId( myElement.text().toLong() );

myNode = srsNode.namedItem( "epsg" );
myElement = myNode.toElement();
setEpsg( myElement.text().toLong() );
myNode = srsNode.namedItem( "srid" );
myElement = myNode.toElement();
setSrid( myElement.text().toLong() );

myNode = srsNode.namedItem( "description" );
myElement = myNode.toElement();
setDescription( myElement.text() );
myNode = srsNode.namedItem( "epsg" );
myElement = myNode.toElement();
setEpsg( myElement.text().toLong() );

myNode = srsNode.namedItem( "projectionacronym" );
myElement = myNode.toElement();
setProjectionAcronym( myElement.text() );
myNode = srsNode.namedItem( "description" );
myElement = myNode.toElement();
setDescription( myElement.text() );

myNode = srsNode.namedItem( "ellipsoidacronym" );
myElement = myNode.toElement();
setEllipsoidAcronym( myElement.text() );
myNode = srsNode.namedItem( "projectionacronym" );
myElement = myNode.toElement();
setProjectionAcronym( myElement.text() );

myNode = srsNode.namedItem( "geographicflag" );
myElement = myNode.toElement();
if ( myElement.text().compare( "true" ) )
{
setGeographicFlag( true );
}
else
{
setGeographicFlag( false );
}
myNode = srsNode.namedItem( "ellipsoidacronym" );
myElement = myNode.toElement();
setEllipsoidAcronym( myElement.text() );

//make sure the map units have been set
setMapUnits();
myNode = srsNode.namedItem( "geographicflag" );
myElement = myNode.toElement();
if ( myElement.text().compare( "true" ) )
{
setGeographicFlag( true );
}
else
{
setGeographicFlag( false );
}

//@TODO this srs needs to be validated!!!
mIsValidFlag = true;//shamelessly hard coded for now
//make sure the map units have been set
setMapUnits();

//@TODO this srs needs to be validated!!!
mIsValidFlag = true;//shamelessly hard coded for now
}
}
}
else
Expand Down

0 comments on commit 3cbe7c3

Please sign in to comment.