How to make an svg symbol editable ( color , stroke ) in QGis

If you import or create svg symbols to use  them in QGis you will notice that the color options as well as the outline of these symbols are disabled in QGis. In fact , these settings are coded in hard in the svg file and , if you want to make them available , you are forced to create as many symbols as colors desired .

Here is a little tip that will save you time by creating only one symbol and activating the color controls and contour in QGis for this symbole. Let’s take the following symbol as an example

The color and border change block is inactive . The color of the arrows is black because such is the definition contained in the svg file .

We will edit simply the svg file to change this state of affairs. The change is very simple , you can use any text editor. Open the file :

After the header lines, you find the tag <path and the beginning of the definition of the symbol d =

Between the two, you can find settings such as style = “fill : # 000000″ or others .

The trick is to replace all that is between <path and the text = following

fill = “ param (fill) #FFF” stroke = “ param (outline) # 000″ stroke-width = “ param (outline-width) 1″ As we see in the following image:

If you use this new file for your style layer , you will see that the options that were inactive are now available :

The symbol is now white by default with black outlines but you can modify them, as well as the thicknesses :  

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *