Skip to content

Commit

Permalink
Merge pull request #1652 from gioman/processing_count_points
Browse files Browse the repository at this point in the history
result field in Processing 'count points in polygon' must be integer
  • Loading branch information
alexbruy committed Oct 23, 2014
2 parents aeb9d93 + 6f30ab9 commit 88e5cde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/qgis/PointsInPolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def processAlgorithm(self, progress):
fieldName = self.getParameterValue(self.FIELD)

polyProvider = polyLayer.dataProvider()
fields = polyProvider.fields()
fields.append(QgsField(fieldName, QVariant.Int))

(idxCount, fieldList) = vector.findOrCreateField(polyLayer,
polyLayer.pendingFields(), fieldName)

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(fieldList.toList(),
self.OUTPUT).getVectorWriter(fields.toList(),
polyProvider.geometryType(),
polyProvider.crs())

Expand Down
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/qgis/PointsInPolygonUnique.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ def processAlgorithm(self, progress):
classFieldName = self.getParameterValue(self.CLASSFIELD)

polyProvider = polyLayer.dataProvider()
fields = polyProvider.fields()
fields.append(QgsField(fieldName, QVariant.Int))

classFieldIndex = pointLayer.fieldNameIndex(classFieldName)
(idxCount, fieldList) = vector.findOrCreateField(polyLayer,
polyLayer.pendingFields(), fieldName)

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(fieldList.toList(),
self.OUTPUT).getVectorWriter(fields.toList(),
polyProvider.geometryType(),
polyProvider.crs())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ def processAlgorithm(self, progress):
self.getParameterValue(self.WEIGHT))

polyProvider = polyLayer.dataProvider()
fields = polyProvider.fields()
fields.append(QgsField(fieldName, QVariant.Int))

(idxCount, fieldList) = vector.findOrCreateField(polyLayer,
polyLayer.pendingFields(), fieldName)

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(fieldList.toList(),
self.OUTPUT).getVectorWriter(fields.toList(),
polyProvider.geometryType(),
polyProvider.crs())

Expand Down

0 comments on commit 88e5cde

Please sign in to comment.