Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle spilhaus projection on proj 9.6 #60679

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/core/proj/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
const bool deprecated = proj_is_deprecated( crs.get() );
const QString name( proj_get_name( crs.get() ) );

QString sql = QStringLiteral( "SELECT parameters,description,deprecated,srs_type FROM tbl_srs WHERE auth_name='%1' AND auth_id='%2'" ).arg( authority, code );
QString sql = QStringLiteral( "SELECT parameters,description,deprecated,srs_type,projection_acronym FROM tbl_srs WHERE auth_name='%1' AND auth_id='%2'" ).arg( authority, code );
statement = database.prepare( sql, result );
if ( result != SQLITE_OK )
{
Expand All @@ -2867,25 +2867,28 @@ int QgsCoordinateReferenceSystem::syncDatabase()
QString dbSrsProj4;
QString dbSrsDesc;
QString dbSrsType;
QString dbOperation;
bool dbSrsDeprecated = deprecated;
if ( statement.step() == SQLITE_ROW )
{
dbSrsProj4 = statement.columnAsText( 0 );
dbSrsDesc = statement.columnAsText( 1 );
dbSrsDeprecated = statement.columnAsText( 2 ).toInt() != 0;
dbSrsType = statement.columnAsText( 3 );
dbOperation = statement.columnAsText( 4 );
}

if ( !dbSrsProj4.isEmpty() || !dbSrsDesc.isEmpty() )
{
if ( proj4 != dbSrsProj4 || name != dbSrsDesc || deprecated != dbSrsDeprecated || dbSrsType != srsTypeString )
if ( proj4 != dbSrsProj4 || name != dbSrsDesc || deprecated != dbSrsDeprecated || dbSrsType != srsTypeString || dbOperation != operation )
{
errMsg = nullptr;
sql = QStringLiteral( "UPDATE tbl_srs SET parameters=%1,description=%2,deprecated=%3, srs_type=%4 WHERE auth_name=%5 AND auth_id=%6" )
sql = QStringLiteral( "UPDATE tbl_srs SET parameters=%1,description=%2,deprecated=%3, srs_type=%4,projection_acronym=%5 WHERE auth_name=%6 AND auth_id=%7" )
.arg( QgsSqliteUtils::quotedString( proj4 ) )
.arg( QgsSqliteUtils::quotedString( name ) )
.arg( deprecated ? 1 : 0 )
.arg( QgsSqliteUtils::quotedString( srsTypeString ),
QgsSqliteUtils::quotedString( operation ),
QgsSqliteUtils::quotedString( authority ), QgsSqliteUtils::quotedString( code ) );

if ( sqlite3_exec( database.get(), sql.toUtf8(), nullptr, nullptr, &errMsg ) != SQLITE_OK )
Expand Down
2 changes: 2 additions & 0 deletions src/core/proj/qgscoordinatereferencesystemutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ QString QgsCoordinateReferenceSystemUtils::translateProjection( const QString &p
return QObject::tr( "Rectangular Polyconic" );
if ( projection == QLatin1String( "sinu" ) )
return QObject::tr( "Sinusoidal (Sanson-Flamsteed)" );
if ( projection == QLatin1String( "spilhaus" ) )
return QObject::tr( "Spilhaus" );
if ( projection == QLatin1String( "somerc" ) )
return QObject::tr( "Swiss Oblique Mercator" );
if ( projection == QLatin1String( "stere" ) )
Expand Down
Loading