On Thu, 25 Jan 2024, 7:04 pm Bernhard Seckinger via QGIS-User, <
[email protected]> wrote:

> 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)
>

setOffset exists, but requires a QPointF argument. See
https://qgis.org/pyqgis/master/core/QgsMarkerSymbolLayer.html#qgis.core.QgsMarkerSymbolLayer.setOffset

Nyall


rule.symbol().changeSymbolLayer(0,marker)
>
> Any ideas?
>
> Thanks, Bernhard
>
> --
> Bernhard Seckinger <[email protected]>
> _______________________________________________
> QGIS-User mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
QGIS-User mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to