Skip to content
Permalink
Browse files

[processing] Fix Geometries algorithm should only keep results

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 38a66e57a584e2a4df16d6c0ad1a932d8a480c48
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/analysis/processing/qgsalgorithmfixgeometries.cpp
@@ -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;
}

0 comments on commit 38a66e5

Please sign in to comment.
You can’t perform that action at this time.