Skip to content
Browse files
[processing] fix example script
  • Loading branch information
alexbruy committed Feb 10, 2016
1 parent 294f033 commit 169d35f31927de39730dd57b21ff0a0604ade5b1
Showing 1 changed file with 7 additions and 3 deletions.
@@ -2,14 +2,18 @@
##class_field=field input
##value_field=field input
##N unique values=output vector
##N_unique_values=output vector

from PyQt4.QtCore import QVariant
from qgis.core import QgsFeature, QgsField
from import VectorWriter

layer = processing.getObject(input)
provider = layer.dataProvider()
fields = provider.fields()
fields.append(QgsField('UNIQ_COUNT', QVariant.Int))
writer = processing.VectorWriter(output, None, fields, provider.geometryType(),
writer = VectorWriter(N_unique_values, None, fields, provider.geometryType(),

class_field_index = layer.fieldNameIndex(class_field)
value_field_index = layer.fieldNameIndex(value_field)

0 comments on commit 169d35f

Please sign in to comment.