Graphics Reference
In-Depth Information
this, replace the p.setDataDefinedProperty(...) line in your program with the
following:
expr = ("CASE WHEN SCALERANK IN (0,1) THEN 18" +
"WHEN SCALERANK IN (2,3,4) THEN 14 " +
"WHEN SCALERANK IN (5,6,7) THEN 12 " +
"WHEN SCALERANK IN (8,9,10) THEN 10 " +
"ELSE 9 END")
p.setDataDefinedProperty(QgsPalLayerSettings.Size,
True,
True, expr, "")
This calculates the font size based on the feature's SCALERANK attribute value. As you
can imagine, using data-defined properties in this way can be extremely useful.
Search WWH ::




Custom Search