[Qgis-developer] scaling points size according to attribute values

Ricardo Filipe Soares Garcia da ricardo.garcia.silva at gmail.com
Sun Dec 27 15:32:24 EST 2009


Hello list
How can I change a points' size according to the values of one of its
attributes programatically? What I mean is achieving the same effect
that the GUI allows in layer properties -> symbology -> area scale
field ?

I have been trying to use the setScaleclassificationField method of
the QgsSymbol class, but it doesn't seem to work...
Here is a piece of my python code, where I try to scale the symbol
according to the gid attribute of a postgis layer:

...
renderer = layer.renderer()
symbols = renderer.symbols()
symbols[0].setScaleClassificationField(provider.fieldNameIndex("gid"))
layer.triggerRepaint()

Instead of what I wanted, this piece of code will reset the symbols'
size to 1 and it doesn't scale them according to the "gid" attribute
at all.
thanks for your help


-- 
___________________________ ___ __
Ricardo Garcia Silva


More information about the Qgis-developer mailing list