[Qgis-developer] custom charts?
Hugo Mercier
hugo.mercier at oslandia.com
Fri Jun 24 05:59:22 PDT 2016
Actually, we already have a "template" concept in SVG, if you look at
the SVG shipped with QGIS, they have things like fill="param(fill)"
allowing to have the filling color as a user parameter.
That could be easily extended to also support feature's attributes and
expressions.
On 24/06/2016 14:45, Raymond Nijssen wrote:
> Hugo,
>
> That would be way cooler!
>
> For now, I just write generated svg files to a temp directory and add
> links to them to every feature.
>
> Strings might get long though. Here is for example the code from my
> dummy image (1.4kb):
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!-- Created with Inkscape (http://www.inkscape.org/) -->
>
> <svg
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xmlns:cc="http://creativecommons.org/ns#"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:svg="http://www.w3.org/2000/svg"
> xmlns="http://www.w3.org/2000/svg"
> version="1.1"
> width="32"
> height="32"
> id="svg2985">
> <defs
> id="defs2987" />
> <metadata
> id="metadata2990">
> <rdf:RDF>
> <cc:Work
> rdf:about="">
> <dc:format>image/svg+xml</dc:format>
> <dc:type
> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
> <dc:title></dc:title>
> </cc:Work>
> </rdf:RDF>
> </metadata>
> <g
> id="layer1">
> <rect
> width="32"
> height="32"
> ry="5.1795878"
> x="0"
> y="0"
> id="rect2993"
> style="fill:#efefef;fill-opacity:1;stroke:none" />
> <path
> d="m 3.2204932,9.8354288 c 0,0 2.1492989,4.3642312
> 5.9021879,4.1948682 2.6857939,-0.121208 2.4849709,-3.285023
> 5.3970119,-3.017097 3.079402,0.283325 2.518907,6.965981
> 6.783374,7.088215 4.047473,0.116014 6.797316,8.50238 6.797316,8.50238"
> id="path3763"
>
> style="fill:none;stroke:#a32800;stroke-width:1.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
> />
> </g>
> </svg>
>
>
>
>
>
>
> On 24-06-16 14:34, Hugo Mercier wrote:
>> It would be also cool to be able to directly use a string as image
>> content for a marker (rather than just for the filename).
>> That should be quite easy to do.
>>
>> On 24/06/2016 14:28, Nathan Woodrow wrote:
>>> Raymond,
>>>
>>> Code generated SVGs is a pretty cool idea. Would be super keen to see
>>> that once you have something!
>>>
>>> On Fri, Jun 24, 2016 at 10:25 PM, Neumann, Andreas <a.neumann at carto.net
>>> <mailto:a.neumann at carto.net>> wrote:
>>>
>>> Pretty cool - so we can deliver script-generated SVG code instead of
>>> a filename? Nice!
>>>
>>> Care to do a blog post with some example? This sounds quite exciting
>>> to me.
>>>
>>> Andreas
>>>
>>> On 2016-06-24 14:12, Raymond Nijssen wrote:
>>>
>>>> Hi Hugo,
>>>>
>>>> It works! Thanks a lot!!
>>>>
>>>> This is exactly what i was looking for, but somehow could not find.
>>>>
>>>> Here is a little example with some fake svg's:
>>>>
>>>> http://terglobo.nl/downloads/example.png
>>>>
>>>> Now I will script generating svg based on real data.
>>>>
>>>> Regards,
>>>> Raymond
>>>>
>>>>
>>>> On 23-06-16 09:02, Hugo Mercier wrote:
>>>>> On 22/06/2016 19:06, Richard Duivenvoorde wrote:
>>>>>> On 22-06-16 14:39, Hugo Mercier wrote:
>>>>>>> Hi Raymond,
>>>>>>>> - Add a text field to my feature layer containig svg, and
>>>>>>>> somehow make
>>>>>>>> qgis display that on my map;
>>>>>>>
>>>>>>> This should work, no ?
>>>>>>
>>>>>> Are you sure? This would mean that the value(!) of an attribute
>>>>>> would
>>>>>> contain the actual svg (code, not filename).
>>>>>> Any example on how to use that with styling then?
>>>>>
>>>>> Hmmm exact, I don't think you can include the content (I tried to
>>>>> include a data url but it does not work).
>>>>>
>>>>>>
>>>>>>>> - Add a text field to my feature layer containig a path to a
>>>>>>>> png (or
>>>>>>>> svg), and somehow make qgis display that on my map.
>>>>>>>
>>>>>>> An SVG marker with the file name defined as an expression ?
>>>>>>
>>>>>> Same here, while we managed to get for example colors dynamic,
>>>>>> we could
>>>>>> not find a way (yet) to set the marker-svg once filename is
>>>>>> retrieved
>>>>>> from an attribute...
>>>>>>
>>>>>> Happy to get an example or pointers :-)
>>>>>
>>>>> with an SVG-marker the filename can be "data-defined", so you can for
>>>>> instance use an expression like '/xxx/mymarker_' || id || '.svg'
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Qgis-developer mailing list
>>>>> Qgis-developer at lists.osgeo.org
>>>>> <mailto:Qgis-developer at lists.osgeo.org>
>>>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>>>
>>>>
>>>> _______________________________________________
>>>> Qgis-developer mailing list
>>>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
More information about the Qgis-developer
mailing list