[Qgis-developer] Re: SVG handling in qgis

Andreas Neumann a.neumann at carto.net
Sun Nov 22 07:56:53 EST 2009


Hi John,

Can you be more specific on what "garbled" means? Does it mean that text 
elements are broken? Or other elements as well? Can you provide an example?

Yes, there are a few problems with proper SVG support in QGIS. Here is a 
summary:

* Import in print composer or symbols:
   - qt only supports the limited SVG tiny format 
(http://www.w3.org/TR/SVGMobile12/). This means as an example that text 
elements do not support <tspan/> childs with a delta y.

* Export from print composer:
   - No clipping/masking of map-data to the map boundaries. Workaround: 
after import in Inkscape, Illustrator or Corel, add a rectangle and 
change it into a rectangular mask and apply them to map group
   - Symbols are exported as raster instead of vector
   - structure of export SVG could be improved and id's could be added 
to better understand the document tree of the output
   - some unnecessary elements are exported.ex

What I can recommend is:
- use the newest Inkscape version (0.47) and avoid multiline text
- save as "Optimized SVG" and not "Inkscape SVG" to keep the filesize 
smaller. Optimized SVG means that the output runs through SVG scour
- in the Inkscape preferences -> SVG output enable the checkbox "inline 
attributes"
- optionally run the output manually through SVG scour (a python 
commandline script) for additional manual optimization 
(http://www.codedread.com/scour/)

Inkscape 0.47 contains Scour, but offers only limited commandline 
switches, not complete control over scour as you can get with the 
commandline version of scour.

Meanwhile I will see if I can extend scour to solve the issue of 
multiline text with tspans. I can't promise when, though ...

Hope this helps,
Andreas


John C. Tull wrote:
> Hi Andreas,
>
> Tim said you were the resident svg guru. I have been running into problems with svg images I have created in Inkscape coming through garbled when rendered in qgis. Tim mentioned a minisvg spec, but I cannot find anything on that from a google search.
>
> Is there a means to output svg files from Inkscape or some other for of conversion to make svg files meet the requirements of qgis?
>
> Thanks,
> John



More information about the Qgis-developer mailing list