Skip to content
Permalink
Browse files

spatialite provider: prefer auth_id over proj4 string (fix #4958)

  • Loading branch information
jef-n committed Feb 7, 2012
1 parent c5f7f1e commit 6878bf1b581fe83752494fb3690e6bc2478c5fb7
@@ -3350,7 +3350,11 @@ void QgsSpatiaLiteProvider::rewind()
QgsCoordinateReferenceSystem QgsSpatiaLiteProvider::crs()
{
QgsCoordinateReferenceSystem srs;
srs.createFromProj4( mProj4text );
srs.createFromOgcWmsCrs( mAuthId );
if ( !srs.isValid() )
{
srs.createFromProj4( mProj4text );
}
return srs;
}

@@ -4777,7 +4781,7 @@ bool QgsSpatiaLiteProvider::getSridDetails()
int columns;
char *errMsg = NULL;

QString sql = QString( "SELECT proj4text FROM spatial_ref_sys WHERE srid=%1" ).arg( mSrid );
QString sql = QString( "SELECT auth_name||':'||auth_srid,proj4text FROM spatial_ref_sys WHERE srid=%1" ).arg( mSrid );

ret = sqlite3_get_table( sqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg );
if ( ret != SQLITE_OK )
@@ -4788,7 +4792,8 @@ bool QgsSpatiaLiteProvider::getSridDetails()
{
for ( i = 1; i <= rows; i++ )
{
mProj4text = results[( i * columns ) + 0];
mAuthId = results[( i * columns ) + 0];
mProj4text = results[( i * columns ) + 1];
}
}
sqlite3_free_table( results );
@@ -363,6 +363,10 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
* Spatial reference id of the layer
*/
int mSrid;
/**
* auth id
*/
QString mAuthId;
/**
* proj4text
*/

0 comments on commit 6878bf1

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