Skip to content

Commit

Permalink
[processing] fix example script
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Feb 10, 2016
1 parent 294f033 commit 169d35f
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -2,14 +2,18 @@
##input=vector
##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 processing.tools.vector 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(),
layer.crs())
writer = VectorWriter(N_unique_values, None, fields, provider.geometryType(),
layer.crs())

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

0 comments on commit 169d35f

Please sign in to comment.