Skip to content

Commit

Permalink
[processing] repair non-working random extract algorithms (fix #11571)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Nov 19, 2014
1 parent 5e6f4c2 commit 3c2d45f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions python/plugins/processing/algs/qgis/RandomExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ def processAlgorithm(self, progress):

selran = random.sample(xrange(0, featureCount), value)

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

for (i, feat) in enumerate(features):
if i in selran:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ def processAlgorithm(self, progress):
value and try again.")
value = value / 100.0


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

selran = []
current = 0
Expand Down

0 comments on commit 3c2d45f

Please sign in to comment.