Skip to content
Permalink
Browse files

result field in Processing 'count points in polygon' must be integer

  • Loading branch information
Giovanni Manghi
Giovanni Manghi committed Oct 23, 2014
1 parent aeb9d93 commit 6f30ab9be7a67f1f5e4afbc12516aa39dd260c80
@@ -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())

@@ -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())

@@ -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())

0 comments on commit 6f30ab9

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