[Qgis-developer] SVG symbols in QGIS with modifiable colors
Otto Dassau
dassau at gbd-consult.de
Thu Jul 19 06:42:53 PDT 2012
Hi Andreas,
I tried the "optimized" SVG output from inkscape - looks better, but still I
can only change fill color, or stroke. But fill seems to overwrite stroke
and I never was able to define stroke-width.
Do you have a more complex example, where I could try to figure out what's
wrong with my tree.svg definition?
Regards
Otto
Am Thu, 19 Jul 2012 14:09:14 +0200
schrieb Andreas Neumann <a.neumann at carto.net>:
> Hi Otto,
>
> Have you tried using presentation attributes only instead of the style
> attribute that mixes everything?
>
> It may be that QGIS only looks into the fill, stroke and stroke-width
> attributes and not in the style attribute.
>
> The way Inkscape exports SVG is a bit of a mess. It also exports way
> too many style attributes (where there are defaults that you could omit)
> with unnecessary repeats (over and over again). A manual SVG code would
> easily be 1/4 of the size that Inkscape generates. But there is an
> option to output an "optimized" or "optimiertes" SVG file where you can
> choose to use "Stil nach XML" (Style to XML).
>
> Hope this helps,
> Andreas
>
> On Thu, 19 Jul 2012 09:52:30 +0200, Otto Dassau wrote:
> > Hi,
> >
> > I tried to follow the howtos in the web about defining colors for svg
> > with
> > param(fill), param(outline) and param(stroke-width).
> >
> > <svg width="100%" height="100%">
> > <rect fill="param(fill) #ff0000" stroke="param(outline) #00ff00"
> > stroke-width="param(stroke-width) 10" width="100" height="100">
> > </rect>
> > </svg>
> >
> > I used a copy from the svg /usr/share/qgis/svg/gpsicons/tree.svg. It
> > looks a
> > little different:
> >
> > [...]
> >
> >
> > style="font-size:12px;stroke:#000000;stroke-width:3;fill:#a7a5a5;fill-opacity:
> >
> >
> > 1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:miter;stroke-linecap:butt"
> > d="M 56.010357,6.2503568 L 30.572857,43.031607 L
> > 37.729107,43.031607 L
> > 23.666607,63.344107 L 33.072857,63.344107 L 18.291607,84.719107
> > L
> > 46.510357,84.719107 L 46.510357,99.812857 L 65.541607,99.812857
> > L
> > 65.541607,84.687857 L
> > [...]
> >
> > All I managed to change is the fill value with the syntax below, but
> > it
> > doesn't work for stroke and stroke width.
> >
> > [...]
> >
> >
> > style="font-size:12px;stroke:param(outline);stroke-width:param(stroke-width);
> >
> >
> > fill:param(fill);fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;
> > stroke-linejoin:miter;stroke-linecap:butt"
> > d="M 56.010357,6.2503568 L 30.572857,43.031607 L
> > 37.729107,43.031607 L
> > 23.666607,63.344107 L 33.072857,63.344107 L 18.291607,84.719107
> > L
> > 46.510357,84.719107 L 46.510357,99.812857 L 65.541607,99.812857
> > L
> > 65.541607,84.687857
> > [...]
> >
> > Has the syntax changed? Or how does it work with more complex svgs. I
> > also
> > created a svg with inkscape, it shows the same syntax as tree.svg.
> >
> > Thanks a lot
> > Otto
> >
> >
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Geoinformatik Büro Dassau - http://www.gbd-consult.de
FOSSGIS consulting , training , support and analysis
Ackerstrasse 144c , D - 40233 Düsseldorf , Germany
Tel: +49-(0)211-98707867 , Mobil: +49-(0)171-4687540
--
Community Advisor - QGIS Project Steering Committee
More information about the Qgis-developer
mailing list