Skip to content

Commit

Permalink
Only use internal crs definition files for GDAL >= 3 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 11, 2019
1 parent e64b3f8 commit dc84c87
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,12 @@ bool QgsCoordinateReferenceSystem::loadIds( QHash<int, QString> &wkts )

Q_FOREACH ( const QString &csv, QStringList() << "gcs.csv" << "pcs.csv" << "vertcs.csv" << "compdcs.csv" << "geoccs.csv" )
{
QString filename = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/" ) + csv;

#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,0,0)
const QString filename = CPLFindFile( "gdal", csv.toUtf8() );
#else
const QString filename = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/" ) + csv;
#endif

QFile f( filename );
if ( !f.open( QIODevice::ReadOnly ) )
Expand Down Expand Up @@ -2159,8 +2164,13 @@ int QgsCoordinateReferenceSystem::syncDatabase()

bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString &dbPath )
{
#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(3,0,0)
const char *filename = CSVFilename( "datum_shift.csv" );
FILE *fp = VSIFOpen( filename, "rb" );
#else
const QString filename = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/datum_shift.csv" );
FILE *fp = VSIFOpen( filename.toUtf8().constData(), "rb" );
#endif
if ( !fp )
{
return false;
Expand Down

0 comments on commit dc84c87

Please sign in to comment.