Skip to content

Commit

Permalink
result field in Processing 'count points in polygon' must be integer
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Manghi committed Oct 23, 2014
1 parent aeb9d93 commit 6f30ab9
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 6f30ab9

Please sign in to comment.