[GIS] Migrating SVG-based styles for QGIS to other computers

qgisqmlsldsvgsymbology

I'm working on a project that has involved creating many recolourable SVG icons and bringing them into QGIS. These are then used in layer symbologies, with these subsequent layer styles exported as .qmls and .slds.

When I open these .qmls on another computer the svg points are not attached – rather there is just a blank spot.

I've tried to get just the svgs to load by exporting the style library from the computer that all of the svgs were created on. However, when I imported this into another computers style library everything was once again blank. Putting the folder with all of the svgs in the C:\Program Files (x86)\Quantum GIS Lisboa\apps\qgis\svg directory is not working either…they show up in the option to select svg icon, however when a layers qml file is loaded it is once again blank.

How can I move these svg/style to other computers so that when I load a file with a set qml layer the proper svgs load as well?

Best Answer

This is how an SVG symbol is defined in QML:

  <symbol outputUnit="MapUnit" alpha="0.329412" type="marker" name="0">
    <layer pass="0" class="SvgMarker" locked="0">
      <prop k="angle" v="0"/>
      <prop k="fill" v="#000000"/>
      <prop k="name" v="/leaf2.svg"/>
      <prop k="offset" v="0,0"/>
      <prop k="outline" v="#000000"/>
      <prop k="outline-width" v="1"/>
      <prop k="size" v="2"/>
    </layer>
  </symbol>

It uses a relative paths to look for the symbol in the folders specified in Settings - Options - Rendering - SVG Paths.

To migrate styles, you have to either copy the new SVGs into an existing SVG path or add a new one.

Related Question