Skip to main content
edited title
Link
underdark
  • 84.5k
  • 22
  • 233
  • 415

Can I Dynamically UpdatingUpdate Symbol Ranges in qgis?

Source Link
Jayden
  • 700
  • 4
  • 11

Dynamically Updating Symbol Ranges in qgis

Background: I'm currently trying to dynamically change the ranges for a layer with new style graduated symbology.

Problem: I thought it may be as simple as updating the ranges for the existing symbology using the setLowerValue() and setUpperValue() methods on the QgsRendererRangeV2 class as below:

layer = qgis.util.iface.activeLayer()
rangePoint = 0
rangeIncrement = 100
for range in layer.rendererV2().ranges():
        range.setLowerValue(rangePoint)
        rangePoint += rangeIncrement
        range.setUpperValue(rangePoint)

By my reconning the API documentation suggests that this should be possible.

However, I am getting the error:

AttributeError: 'QgsRendererRangeV2' object has no attribute 'setLowerValue'

I've tried also using:

range.setLowerValue(float(rangePoint))

with no luck.

What am I doing wrong?