From 704959bcc14fcabe0ed37e329e761af251d24ea4 Mon Sep 17 00:00:00 2001 From: Martin Dobias Date: Sun, 4 Nov 2018 00:58:19 +0100 Subject: [PATCH] [mssql] Do not expect that SRIDs are equivalent to postgis SRIDs There is no direct relationship between postgis SRIDs and SRIDs used in any other database. If you imported data with GDAL, things may work, because GDAL prefers to use equivalent SRIDs to EPSG IDs / PostGIS SRIDs. If you imported data with QGIS, that will not work. QGIS MS SQL provider happily uses internal SRS IDs from srs.db for SRIDs. That should be probably modified to use GDAL's logic: 1. preferably use EPSG ID as SRID 2. if taken, find a safe SRID --- src/providers/mssql/qgsmssqlprovider.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/providers/mssql/qgsmssqlprovider.cpp b/src/providers/mssql/qgsmssqlprovider.cpp index af2a97a19f1..96d493795d1 100644 --- a/src/providers/mssql/qgsmssqlprovider.cpp +++ b/src/providers/mssql/qgsmssqlprovider.cpp @@ -1490,10 +1490,6 @@ QgsCoordinateReferenceSystem QgsMssqlProvider::crs() const { if ( !mCrs.isValid() && mSRId > 0 ) { - mCrs.createFromSrid( mSRId ); - if ( mCrs.isValid() ) - return mCrs; - // try to load crs from the database tables as a fallback QSqlQuery query = createQuery(); query.setForwardOnly( true );