Saturday, 29 October 2016

pyqgis - How to rotate a SVG marker via a data-defined override to the value of one field in a layer


I have a pyqgis stand alone app that display linear features. I put an arrow svg symbol (QgsSvgMarkerSymbolLayerV2) on the line, now I would like to rotate it based on the 'value' field of each line feature in the layer. I tried some variations to the suggested approach below, but they are not working:


sl = QgsSvgMarkerSymbolLayerV2('arrow.svg')
lDD = QgsDataDefined(True, True, 'CASE WHEN "value" < 0 THEN 180.0 ELSE 0.0 END CASE', 'value')
sl.setDataDefinedProperty('angle', lDD)



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...