Speed up getFeatures query by using a proper QgsFeatureRequest

This commit is contained in:
Alessandro Pasotti 2018-10-19 16:27:18 +02:00
parent 71e2a6be7e
commit adb930b204

View File

@ -183,7 +183,7 @@ def execute_in_place_run(alg, parameters, context=None, feedback=None, raise_exc
else:
active_layer.deleteFeature(f.id())
# Get the new ids
old_ids = set([f.id() for f in active_layer.getFeatures()])
old_ids = set([f.id() for f in active_layer.getFeatures(req)])
if not active_layer.addFeatures(new_features):
raise QgsProcessingException(tr("Error adding processed features back into the layer."))
new_ids = set([f.id() for f in active_layer.getFeatures(req)])