Thursday 31 August 2017

symbology - How to display different SVG icon in the same layer in QGIS based on attribute value


Based on this question: How to display different SVG icon in the same layer in QGIS is it possible to add multiple svg files in qgis to the same layer automatically based on attribute value? I have a world dataset and world flags svg files. Can I visualize the flags somehow automatically? (for example adding the path as attribute to each record?)



Answer



Yes I think so. Any aspect of symbology in QGIS can be data driven, also the path to an svg symbol e.g. You don't even need an attribute holding the complete path, you might create an expression that derives the path from another attributes content (here attribute "the_land_of_the_flag"), say:



concat('the/path/to/my/svg/symbols/', "the_land_of_the_flag", '.svg')

giving


'the/path/to/my/svg/symbols/germany.svg'

for example.


Here is a screenshot where to access this feature (QGIS 2.14.1):


enter image description here


And then:


enter image description here



Unfortunatly I have the German version, hope this helps as well.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...