[Qgis-user] adding offset to QgsSvgMarkerSymbolLayer using pyqgis

Bernhard Seckinger bernhard.seckinger at bueffee.de
Thu Jan 25 01:03:34 PST 2024


Hi,

I wrote a plugin which changes the symbology of a layer using SVG-images.
Almost everything works but I need to add an offset to the SVG-image and did
not find a way to set it from pyqgis.

That's what I'm doing currently (rule is a rule from a QgsRuleBasedRenderer):

icon = os.path.dirname(__file__) + 'a.svg';
marker = QgsSvgMarkerSymbolLayer(icon)
marker.setAngle(100) # setting the angle works
# marker.setOffset(5,5) # this doesn't work (there is no setOffset method)
rule.symbol().changeSymbolLayer(0,marker)

Any ideas?

Thanks, Bernhard

--
Bernhard Seckinger <bernhard.seckinger at bueffee.de>


More information about the QGIS-User mailing list