7

If you use SVG symbols within QGIS you can use params like these so you can adjust properties interactively in QGIS:

fill = param(fill) 
fill-opacity = param(fill-opacity) 
stroke = param(outline) 
stroke-width = param(outline-width) 
stroke-opacity = param(outline-opacity)

I would like to do the same with text within an SVG-image: Use (text-)placeholders in the SVG and fill in the actual text stored as QGIS variables within the print composer:

example

Is this already possible?

5
+50

You can display SVG with HTML like :

<!DOCTYPE html>
<html>
<body>

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>

</body>
</html>

source : https://www.w3schools.com/html/html5_svg.asp

In a print composer, create a text label and check Render as HTML, you can place variables in placeholders :

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="[%@color%]" />
</svg>
  • 1
    Great Idea. I guess it's the only way to use qgis variables inside svg graphics at the moment. – markgraeflerland Sep 9 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.