I have an SVG graphic which should be placed in certain locations on my map in QGIS 2.18.

Original_SVG_Marker

I can open it through Adobe Photoshop, Inkscape, Chrome, it even obeys Internet Explorer.

As for me, everything looks okay when I check my SVG element through Notepad++.

It is accessible via JSFiddle: SVG_Example

However, when I modify the point symbology through

Layer Properties > Style > Single Symbol > SVG Marker

I am getting a fully black icon, see the image below.

Any suggestions on how can I overcome this issue?

SVG_Result_in_QGIS

  • 2
    I would suggest linking the SVG or quoting the SVG's markup in the question. There is no way to know what's wrong with it as it is. – Gabriel C. Sep 12 at 13:54
up vote 4 down vote accepted

In my case deleting <defs> and </defs> (but not it's content) from the SVG graphics for instance with Notepad++ solved my issue. See the image below.

<defs> #delete this tag
<style>
  .cls-1{fill:url(#Unbenannter_Verlauf_20);}
  .cls-2{fill:#80ba27;}
</style>

<linearGradient id="Unbenannter_Verlauf_20" x1="25.35" y1="50" x2="25.35" gradientUnits="userSpaceOnUse">
  <stop offset="0" stop-color="#004a99"/>
  <stop offset="0.36" stop-color="#024d99"/>
  <stop offset="0.63" stop-color="#075699"/>
  <stop offset="0.86" stop-color="#106699"/>
  <stop offset="0.91" stop-color="#136b99"/>
</linearGradient>
</defs> #delete this tag

Result_Example

References

I had a similar case after creating a svg via Notepad++ and was able to solve it by copying header-data from a different, working svg-file until the new file worked. Rather crude solution, but it works.

  • Erik your suggestion partially helped me. Thank! If you do not mind can I put a proper answer to my question? – Taras Sep 12 at 13:40
  • Feel free to do so, if you found a more fitting solution. – Erik Sep 12 at 13:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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