[Qgis-user] adding offset to QgsSvgMarkerSymbolLayer using pyqgis

Frank Broniewski broniewski at a-a.lu
Thu Jan 25 01:54:46 PST 2024


But there is markerOffset2 and/or markerOffsetWithWidthAndHeight, maybe this does what you want?

https://qgis.org/pyqgis/master/core/QgsSvgMarkerSymbolLayer.html

HTH,
Frank

________________________________
Von: QGIS-User <qgis-user-bounces at lists.osgeo.org> im Auftrag von Bernhard Seckinger via QGIS-User <qgis-user at lists.osgeo.org>
Gesendet: Donnerstag, 25. Januar 2024 10:03
An: qgis-user at lists.osgeo.org <qgis-user at lists.osgeo.org>
Betreff: [Qgis-user] adding offset to QgsSvgMarkerSymbolLayer using pyqgis

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>
_______________________________________________
QGIS-User mailing list
QGIS-User at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240125/c71742ab/attachment.htm>


More information about the QGIS-User mailing list