Uploaded image for project: 'GeoTools'
  1. GEOT-5517

Add support for parametric SVGs (QGIS/SVG Parameter style)


    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 16-beta
    • Component/s: None
    • Labels:


      From the mailing list:

      working on the QGIS SLD exported I've found one cool feature based on existing standards,
      that is, the ability to parametrize SVGs colors, line thicknesses and the like.

      The QGIS library of SVGs contains seems to be all black at a first glance, e.g.:
      but looking at the sources you'll find the use of the "param" function, e.g.:

      In particular:

      <path fill="param(fill)" fill-opacity="param(fill-opacity)" stroke="param(outline)" stroke-opacity="param(outline-opacity)" stroke-width="param(outline-width)" ...

      This comes from an official SVG extension draft found here:

      The QGis UI allows to control said parameters and get out a colored symbol, all in all similar to our mark support (which QGis also
      has, but it's under the "simple symbol" category):

      I'm suggesting we implement the same, it adds a significant improvement and would allow
      to use the extensive SVG symbol set already provided in QGIS.
      Mind, this is a bit more flexible than marks, in that one could parameterize certain parts and not
      others, or have two outline colors for two semantically different types of outline, and so on, thus
      I'm not proposing to go and create a mark factory for it. It is also to be noted that the parametrization
      of SVGs in QGis has been growing over time, so leveraging the exact same mechanism will make it
      easier to stay on par.

      Syntax wise, I have been torn a bit between adding vendor params and using the URL params:

      After a bit of thinking, I propose to use URL params, as they are local to the symbol, while vendor params
      are currently at the symbolizer level, too far up in the containment hierarchy (a complex symbol could contain
      more than one SVG reference), adding them to Graphic would be possible, but also an API break.




            • Assignee:
              aaime Andrea Aime
              aaime Andrea Aime
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: