Skip to content
Browse files

[processing] Use faster expression request for ExtractByAttribute

  • Loading branch information
nyalldawson committed Nov 16, 2015
1 parent e15962e commit 48afc425dcc4404895c2054c6255047a7371acb4
Showing with 7 additions and 10 deletions.
  1. +7 −10 python/plugins/processing/algs/qgis/
@@ -26,7 +26,7 @@
__revision__ = '$Format:%H$'

from PyQt4.QtCore import QVariant
from qgis.core import QgsExpression
from qgis.core import QgsExpression, QgsFeatureRequest
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterVector
@@ -117,15 +117,12 @@ def processAlgorithm(self, progress):'Unsupported field type "%s"' % fields[idx].typeName()))

expression = QgsExpression(expr)

features = vector.features(layer)
if not expression.hasParserError():
req = QgsFeatureRequest(expression)
raise GeoAlgorithmExecutionException(expression.parserErrorString())

count = len(features)
total = 100.0 / float(count)
for count, f in enumerate(features):
if expression.evaluate(f, fields):
progress.setPercentage(int(count * total))
for f in layer.getFeatures(req):

del writer

0 comments on commit 48afc42

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