Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix typo in the short help and improve field equality expression
  • Loading branch information
alexbruy committed May 13, 2020
1 parent 3a51f93 commit e4f1d5c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp
Expand Up @@ -47,11 +47,12 @@ QString QgsSplitVectorLayerAlgorithm::groupId() const

QString QgsSplitVectorLayerAlgorithm::shortHelpString() const
{
return QObject::tr( "Splits input vector layer into multiple layers by specified unique ID field."
"Each of the layers created in the output folder contains all features from "
"the input layer with the same value for the specified attribute. The number "
":of files generated is equal to the number of different values found for the "
"specified attribute." );
return QObject::tr( "Splits input vector layer into multiple layers by specified unique ID field." )
+ QStringLiteral( "\n\n" )
+ QObject::tr( "Each of the layers created in the output folder contains all features from "
"the input layer with the same value for the specified attribute. The number "
"of files generated is equal to the number of different values found for the "
"specified attribute." );
}

QgsSplitVectorLayerAlgorithm *QgsSplitVectorLayerAlgorithm::createInstance() const
Expand Down Expand Up @@ -107,7 +108,7 @@ QVariantMap QgsSplitVectorLayerAlgorithm::processAlgorithm( const QVariantMap &p
feedback->pushInfo( QObject::tr( "Creating layer: %1" ).arg( fileName ) );

sink.reset( QgsProcessingUtils::createFeatureSink( fileName, context, fields, geometryType, crs ) );
QString expr = QStringLiteral( "%1 = %2" ).arg( QgsExpression::quotedColumnRef( fieldName ), QgsExpression::quotedValue( *it ) );
QString expr = QgsExpression::createFieldEqualityExpression( fieldName, *it );
QgsFeatureIterator features = source->getFeatures( QgsFeatureRequest().setFilterExpression( expr ) );
while ( features.nextFeature( feat ) )
{
Expand Down

0 comments on commit e4f1d5c

Please sign in to comment.