Skip to content
Permalink
Browse files
More server warnings on transformation errors
  • Loading branch information
elpaso authored and nyalldawson committed May 25, 2021
1 parent 8ac4a73 commit dfaafa69c630229951fb305a373d95a14df85df2
Showing with 21 additions and 4 deletions.
  1. +21 −4 src/server/qgsserver.cpp
@@ -233,10 +233,19 @@ bool QgsServer::init()
const QgsCoordinateReferenceSystem & destinationCrs,
const QgsDatumTransform::TransformDetails & details )
{
QgsServerLogger::instance()->logMessage( QStringLiteral( "Cannot use project transform between %1 and %2 - %3" )
QString gridMessage;
for ( const QgsDatumTransform::GridDetails &grid : details.grids )
{
if ( !grid.isAvailable )
{
gridMessage.append( QStringLiteral( "This transformation requires the grid file '%1', which is not available for use on the system.\n" ).arg( grid.shortName ) );
}
}
QgsServerLogger::instance()->logMessage( QStringLiteral( "Cannot use project transform between %1 and %2 - %3.\n%4" )
.arg( sourceCrs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::ShortString ),
destinationCrs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::ShortString ),
details.name ),
details.name,
gridMessage ),
QStringLiteral( "QGIS Server" ), Qgis::MessageLevel::Warning );
} );

@@ -272,8 +281,9 @@ bool QgsServer::init()
accuracyMessage = QStringLiteral( "Current transform '%1' has an accuracy of %2 meters, while the preferred transformation '%3' has accuracy %4 meters.\n" ).arg( availableOperation.name )
.arg( availableOperation.accuracy ).arg( preferredOperation.name ).arg( preferredOperation.accuracy );
else if ( preferredOperation.accuracy >= 0 )
accuracyMessage = QStringLiteral( "Current transform '%1' has an unknown accuracy, while the preferred transformation '%2' has accuracy %3 meters.\n" ).arg( availableOperation.name )
.arg( preferredOperation.name ).arg( preferredOperation.accuracy );
accuracyMessage = QStringLiteral( "Current transform '%1' has an unknown accuracy, while the preferred transformation '%2' has accuracy %3 meters.\n" )
.arg( availableOperation.name, preferredOperation.name )
.arg( preferredOperation.accuracy );

const QString longMessage = QStringLiteral( "The preferred transform between '%1' and '%2' is not available for use on the system.\n" ).arg( sourceCrs.userFriendlyIdentifier(),
destinationCrs.userFriendlyIdentifier() )
@@ -283,6 +293,13 @@ bool QgsServer::init()

} );

QgsCoordinateTransform::setCustomCoordinateOperationCreationErrorHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs, const QgsCoordinateReferenceSystem & destinationCrs, const QString & error )
{
const QString longMessage = QStringLiteral( "No transform is available between %1 and %2: %3" )
.arg( sourceCrs.userFriendlyIdentifier(), destinationCrs.userFriendlyIdentifier(), error );
QgsServerLogger::instance()->logMessage( longMessage, QStringLiteral( "QGIS Server" ), Qgis::MessageLevel::Warning );
} );

// Configure locale
initLocale();

0 comments on commit dfaafa6

Please sign in to comment.