Skip to content

Commit

Permalink
[processing] Don't force promote point layers to multipoint when
Browse files Browse the repository at this point in the history
running clipping/subtraction style algorithms

There's no way a point can become multipoint as a result of
a clip or subtraction
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Dec 9, 2021
1 parent 71208e6 commit a5e4946
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmclip.cpp
Expand Up @@ -101,7 +101,7 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap &parameters, Q

QString dest;
const QgsWkbTypes::GeometryType sinkType = QgsWkbTypes::geometryType( featureSource->wkbType() );
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, featureSource->fields(), QgsWkbTypes::multiType( featureSource->wkbType() ), featureSource->sourceCrs() ) );
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, featureSource->fields(), QgsWkbTypes::promoteNonPointTypesToMulti( featureSource->wkbType() ), featureSource->sourceCrs() ) );

if ( !sink )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmdifference.cpp
Expand Up @@ -96,7 +96,7 @@ QVariantMap QgsDifferenceAlgorithm::processAlgorithm( const QVariantMap &paramet
if ( !sourceB )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "OVERLAY" ) ) );

const QgsWkbTypes::Type geomType = QgsWkbTypes::multiType( sourceA->wkbType() );
const QgsWkbTypes::Type geomType = QgsWkbTypes::promoteNonPointTypesToMulti( sourceA->wkbType() );

QString dest;
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, sourceA->fields(), geomType, sourceA->sourceCrs() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmextractbyextent.cpp
Expand Up @@ -77,7 +77,7 @@ QVariantMap QgsExtractByExtentAlgorithm::processAlgorithm( const QVariantMap &pa
const bool clip = parameterAsBoolean( parameters, QStringLiteral( "CLIP" ), context );

// if clipping, we force multi output
const QgsWkbTypes::Type outType = clip ? QgsWkbTypes::multiType( featureSource->wkbType() ) : featureSource->wkbType();
const QgsWkbTypes::Type outType = clip ? QgsWkbTypes::promoteNonPointTypesToMulti( featureSource->wkbType() ) : featureSource->wkbType();

QString dest;
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, featureSource->fields(), outType, featureSource->sourceCrs() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmfixgeometries.cpp
Expand Up @@ -57,7 +57,7 @@ QString QgsFixGeometriesAlgorithm::outputName() const

QgsWkbTypes::Type QgsFixGeometriesAlgorithm::outputWkbType( QgsWkbTypes::Type type ) const
{
return QgsWkbTypes::multiType( type );
return QgsWkbTypes::promoteNonPointTypesToMulti( type );
}

QString QgsFixGeometriesAlgorithm::shortHelpString() const
Expand Down
Expand Up @@ -79,7 +79,7 @@ QVariantMap QgsSymmetricalDifferenceAlgorithm::processAlgorithm( const QVariantM
if ( !sourceB )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "OVERLAY" ) ) );

const QgsWkbTypes::Type geomType = QgsWkbTypes::multiType( sourceA->wkbType() );
const QgsWkbTypes::Type geomType = QgsWkbTypes::promoteNonPointTypesToMulti( sourceA->wkbType() );

const QString overlayFieldsPrefix = parameterAsString( parameters, QStringLiteral( "OVERLAY_FIELDS_PREFIX" ), context );
const QgsFields fields = QgsProcessingUtils::combineFields( sourceA->fields(), sourceB->fields(), overlayFieldsPrefix );
Expand Down

0 comments on commit a5e4946

Please sign in to comment.