Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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

(cherry picked from commit 704959b)
  • Loading branch information
wonder-sk authored and nyalldawson committed Nov 6, 2018
1 parent 637f47c commit f1cfa1a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit f1cfa1a

Please sign in to comment.