Sunday 24 July 2016

qgis - Using SVG from Wikipedia to fill polygon?


I'm trying to use the flag of each region in Italy to fill each region's polygon. I have downloaded the shapefile of Administrative areas for Italy from diva-gis and am now attempting to fill each of the 20 polygons with the corresponding flag image taken from Wikipedia at http://en.wikipedia.org/wiki/Regions_of_Italy


When you click on the flag image on the wikipedia page, and try to download a single flag, such as Sardinia:


http://en.wikipedia.org/wiki/Regions_of_Italy#mediaviewer/File:Flag_of_the_Italian_region_Sardinia.svg


you see that the images are already in svg format. However, when I attempt to use them in QGIS, all I see is blank space.



I downloaded Inkscape as I read somewhere this would be the appropriate tool for dealing with SVG, however opening the file in Inkscape and saving as SVG does not result in anything different.


There are 20 regions in Italy and therefore 20 flags, can someone lead me in the right direction?


My plan of attack so far is to change the Style to Categorized and classify the regions of Italy by the NAME_1 Column (which is the region name) and then change each symbol layer type to SVG fill. After that I was thinking I would download each SVG flag individually from wiki and chose it for the SVG fill by clicking on the ellipses (...) button and navigating to the appropriate file.



Answer



You have to create a folder called "svg" in your ".qgis2" directory. You should be able to find this in:


C:\Users\(your user name)\.qgis2

Then create the new svg folder, insert your flags in there and you should be able to see them in your Style > Symbol interface:


Symbol selector


For me, QGIS did tend to run a bit slow so it may be a good idea to first follow the answer provided by @hexamon.



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...