Skip to main content
3 of 11
added 359 characters in body
Taras
  • 34k
  • 4
  • 73
  • 148

A working Example

Let's assume there is a point layer with three point features in it, see image below

input

Proceed with: RMC > Properties > Symbology > Symbol layer type: SVG Marker.

Then go to the Dynamic SVG parameters > Edit... , where paste the following expression:

CASE
    WHEN "id" = 1 THEN 'C://TempDaten//socicon_amazon.svg'
    WHEN "id" = 2 THEN 'C://TempDaten//socicon_google+.svg'
    ELSE 'C://TempDaten//socicon_apple.svg'
END

window

and get the following result:

result

Above I am working with a folder C://TempDaten where all my SVG markers are stored.

A HOW TO chapter

Here I tried to sum up some basics regarding the referencing to a SVG file. (Mind that it could vary depending on the OS)

Approach Working ?
/ (single slash) ✅ yes
// (double slash) ✅ yes
\ (single backslash) ❌ no
\\ (double backslash) ✅ yes
@project_folder || '/yourfile.svg' ✅ yes
@project_folder || '//yourfile.svg' ✅ yes
@project_folder || '\\yourfile.svg' ✅ yes

I am on Windows 10 with QGIS 3.18.1-Zürich.


References:

Taras
  • 34k
  • 4
  • 73
  • 148