Skip to content
Permalink
Browse files

First try with EPSG ID, then proj4 matching, when reading CRS from pr…

…oject file

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11516 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann
homann committed Aug 26, 2009
1 parent 64c0b33 commit 28a46c8cb408e8cdbf373278c59601dba5c8d5b4
Showing with 51 additions and 38 deletions.
  1. +51 −38 src/core/qgscoordinatereferencesystem.cpp
@@ -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

0 comments on commit 28a46c8

Please sign in to comment.
You can’t perform that action at this time.