Skip to content

Commit

Permalink
[processing] fixes extract by location alg (fixes #10241)
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed May 28, 2014
1 parent a3628a6 commit c0b3e90
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/plugins/processing/algs/qgis/ftools/ExtractByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INTERSECT)
selectLayer = dataobjects.getObjectFromUri(filename)
index = vector.spatialindex(layer)

output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.pendingFields(),
layer.dataProvider().geometryType(), layer.crs())

geom = QgsGeometry()
selectedSet = []
Expand All @@ -73,12 +77,8 @@ def processAlgorithm(self, progress):
selectedSet.append(feat.id())
progress.setPercentage(int(current * total))

output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.layer.pendingFields().toList(),
layer.geometryType(), layer.crs())

for (i, feat) in enumerate(features):
if feat.id() in selectedSet:
writer.addFeature(feat)
for i, f in enumerate(vector.features(layer)):
if f.id() in selectedSet:
writer.addFeature(f)
progress.setPercentage(100 * i / float(featureCount))
del writer

0 comments on commit c0b3e90

Please sign in to comment.