Skip to content

Instantly share code, notes, and snippets.

@jef-n
Created January 18, 2012 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jef-n/1636066 to your computer and use it in GitHub Desktop.
Save jef-n/1636066 to your computer and use it in GitHub Desktop.
diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp
index e2b8219..8b5d267 100755
--- a/src/providers/postgres/qgspostgresprovider.cpp
+++ b/src/providers/postgres/qgspostgresprovider.cpp
@@ -538,7 +538,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
{
qBox = QString( "setsrid('BOX3D(%1)'::box3d,%2)" )
.arg( rect.asWktCoordinates() )
- .arg( mDetectedSrid );
+ .arg( mRequestedSrid );
}
else
{
@@ -547,7 +547,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
.arg( rect.yMinimum() )
.arg( rect.xMaximum() )
.arg( rect.yMaximum() )
- .arg( mDetectedSrid );
+ .arg( mRequestedSrid );
}
whereClause = QString( "%1 && %2" )
@@ -562,7 +562,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
}
}
- if ( !mRequestedSrid.isEmpty() && mRequestedSrid != mDetectedSrid )
+ if ( mRequestedSrid != mDetectedSrid )
{
whereClause += QString( " AND %1(%2)=%3" )
.arg( mConnectionRO->majorVersion() < 2 ? "srid" : "st_srid" )
@@ -1816,7 +1816,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
.arg( mConnectionRO->majorVersion() < 2 ? "geomfromwkb" : "st_geomfromwkb" )
.arg( offset++ )
.arg( mConnectionRW->useWkbHex() ? "" : "::bytea" )
- .arg( mDetectedSrid );
+ .arg( mRequestedSrid );
delim = ",";
}
@@ -2318,7 +2318,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( mConnectionRW->majorVersion() < 2 ? "geomfromwkb" : "st_geomfromwkb" )
.arg( mConnectionRW->useWkbHex() ? "" : "::bytea" )
- .arg( mDetectedSrid )
+ .arg( mRequestedSrid )
.arg( pkParamWhereClause( 2 ) );
QgsDebugMsg( "updating: " + update );
@@ -2718,6 +2718,11 @@ bool QgsPostgresProvider::getGeometryDetails()
mDetectedGeomType = QgsPostgresConn::geomTypeFromPostgis( type );
mDetectedSrid = srid;
+ if( mRequestedSrid.isEmpty() )
+ {
+ mRequestedSrid = srid;
+ }
+
mValid = mDetectedGeomType != QGis::UnknownGeometry || mRequestedGeomType != QGis::UnknownGeometry;
if ( !mValid )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment