Simple SVG Qgis Plugin
SimpleSvg is a plugin which tries to save current map as SVG. Other then the normal SaveAsSVG in the composer, this plugin tries to keep the GIS-grouping intact:
layers in Qgis will be layers in Inkscape, symbol classes will be groups. Objects will have ids with the layername in it, so the id's kan be used of a search in
the xml-view of Inkscape.
The plugin uses the screen coordinates (pixel values) to set the svg coordinates.
Before version 0.8 the plugin picked only the features that were at least touching the current map view.
Since 0.8 there is a checkbox, which UNchecked will make the plugin just fetch ALL vector objects from all layers.
This means that for example you can load all countries of the world, zoom in to the netherlands (aka set a sort of 'resolution' for the coordinates) and
then let the generate svg (at that scale) for all data in the data set.
Be carefull though: fetching ALL data from big dataset can give other problems.
It can work with 'Old Symbology' and partially with 'New Symbology' both for vector- and raster layers. A raster layer will be saved as image and included as an image element
with an external (to the file next to the svg).
The plugin wil also work with layers which have 'on the fly' projection enabled.
For lines and polygons it tries to save both pen and symbol style, most classifications are working.
For Points it can only save a point as a small colored circle.
Please sent further ideas and requests to richard@duif.net
A view of the Netherlands in qgis with a point, polygon and line vector layer, and a raster on the bottom:
Download the svg generated with the plugin: svgtest.svg
This svg loaded in Inkscape:
The plugin is available via the official contributed qgis repositories (as experimental plugin!) or you can download latest plugin in zip here
TODO's and idea's
- better gui with more options
- use labels or names for features/objects
- add help button
- use of world coordinates and projection in svg (not yet used in Inkscape??)
- handle 'on the fly' projection
- handle polygon with holes
- handle new symbology (simple symbolisation)
- including advanced svg tags
- use svg symbols as points
- css styling?
- linking xref's for styles for symbols (css?)
Versions
- 0.8.5 (04-2014): making labels work again, but bump min version to 2.0, and keeping the layers and names usable in Inkscape
- 0.8.4 (01-2014): fix http://hub.qgis.org/issues/7971 thanks Scott Heavner
- 0.8.3 (11-2013): fix with maprezing, thanks Christoph König, plus some other bugfixes
- 0.8.2 (10-2013): fix for bug when saving raster
- 0.8.1 (06-2013): work of Hien Tran-Quang, make it work for sip2 and QGIS2
- 0.8 (06-2013): checkbox to just retrieve ALL features (meaning you actuall set a resolution for svg); more changes needed for QGIS 2.0 api (thanks Hien TRAN-QUANG)
- 0.7 (01-2013): changes needed for QGIS 2.0 api, move to web menu
- 0.6 (02-2012): addition of On The Fly Projection, new dialogs, addition of mapResizer(dialog), fixes in Unique Value Classification
- 0.5 (08-2011): fix for wrong path for raster layer, individual g-element grouped by symbol, first steps to making it possible to use New Symbology ("singleSymbol", "categorizedSymbol", "graduatedSymbol"), label-color used now
- 0.4 (06-2011): IF qgis has (had) a label, use that field as inkscape:label for easy find/recognition of element; fix for unicode/utf-8 errors (problems with labels and filename with non-ascii characters; fix for bug with non-visible layers; cleanup of code and svg; viewport is now mapcanvas size
- 0.3 (06-2011): fix for invalid svg for polygons with holes, implementation for multilines added, special qgisview rectangle to clip/crop the map, qgis notice in svg added
- 0.2 (06-2011): handles rasters, grouping per layer, inkscape specific attributes, all classification of old symbology working
- 0.1 (0?-20??): initial version, for internal use
Resources and inspiration
Cartoweb
Mappetizer
Tips, comments, questions: richard at-sign duif.net (Richard Duivenvoorde)