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

Fix processing (unreported) : Merge vector layer algorithm fail in the case a field name already but with different length or precision #60842

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions src/analysis/processing/qgsalgorithmmergevector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ QVariantMap QgsMergeVectorAlgorithm::processAlgorithm( const QVariantMap &parame
destField.setLength( 0 );
destField.setPrecision( 0 );
}
else if ( destField.type() == QMetaType::Type::QString && destField.length() < sourceField.length() )
{
feedback->pushWarning( QObject::tr( "%1 field in layer %2 has different field length than the destination layer (%3 vs %4). "
"%1 field length will be extended to match the larger of the two." )
.arg( sourceField.name(), layerName, QString::number( sourceField.length() ), QString::number( destField.length() ) ) );
destField.setLength( sourceField.length() );
}
else if ( destField.type() == QMetaType::Type::Double && destField.precision() < sourceField.precision() )
{
feedback->pushWarning( QObject::tr( "%1 field in layer %2 has different field precision than the destination layer (%3 vs %4). "
"%1 field precision will be extended to match the larger of the two." )
.arg( sourceField.name(), layerName, QString::number( sourceField.length() ), QString::number( destField.length() ) ) );
destField.setPrecision( sourceField.precision() );
}
break;
}
}
Expand Down
Loading