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