[Qgis-user] PyQGIS question: get SVG content with resolved param() values from QgsSvgMarkerSymbolLayer or QgsSVGFillSymbolLayer
jacob chaar
jacobchaar at live.ca
Thu May 7 08:20:45 PDT 2026
Hello QGIS community,
I am working on a QGIS plugin, and I have a question about SVG symbol rendering in PyQGIS.
I am using SVG-based symbol layers (for example, QgsSvgMarkerSymbolLayer / QgsSVGFillSymbolLayer).
The SVG file contains placeholders such as param(fill), param(fill-opacity), param(outline), etc.
In Python, I can access:
- the SVG path (path()/svgFilePath())
- the symbol layer properties (color, opacity, outline, etc.)
What I need is the final SVG XML content with those param(...) values already resolved, exactly as QGIS uses it at render time.
My questions:
1. Is there a public PyQGIS API that returns the resolved SVG source (not just a rendered image)?
2. If not, is there a recommended approach to reproduce QGIS resolution logic reliably?
3. Are there edge cases I should handle (quoted params, default values, data-defined overrides, expression-based values)?
Any guidance or examples would be very appreciated.
Thank you!
Best regards,
Jacob Ch.
More information about the QGIS-User
mailing list