Skip to content

Commit

Permalink
[processing] Fix Geometries algorithm should only keep results
Browse files Browse the repository at this point in the history
with the same geometry type as the original features

Otherwise it's inserting points into line features when the
geometry repair results in a point geometry only
  • Loading branch information
nyalldawson committed Nov 29, 2017
1 parent a3a79b9 commit 38a66e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/analysis/processing/qgsalgorithmfixgeometries.cpp
Expand Up @@ -100,7 +100,16 @@ QgsFeature QgsFixGeometriesAlgorithm::processFeature( const QgsFeature &feature,
}

outputGeometry.convertToMultiType();
outputFeature.setGeometry( outputGeometry );
if ( QgsWkbTypes::geometryType( outputGeometry.wkbType() ) != QgsWkbTypes::geometryType( feature.geometry().wkbType() ) )
{
// don't keep geometries which have different types - e.g. lines converted to points
feedback->pushInfo( QObject::tr( "Fixing geometry for feature %1 resulted in %2, geometry has been dropped." ).arg( feature.id() ).arg( QgsWkbTypes::displayString( outputGeometry.wkbType() ) ) );
outputFeature.clearGeometry();
}
else
{
outputFeature.setGeometry( outputGeometry );
}
return outputFeature;
}

Expand Down

0 comments on commit 38a66e5

Please sign in to comment.