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

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

    Details

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

      Description

      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.:
      https://github.com/qgis/QGIS/blob/master/images/svg/food/food_cafe.svg
      but looking at the sources you'll find the use of the "param" function, e.g.:
      https://raw.githubusercontent.com/qgis/QGIS/master/images/svg/food/food_cafe.svg

      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:
      https://www.w3.org/TR/SVGParamPrimer/

      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:
      https://www.w3.org/TR/SVGParamPrimer/#URLParameters

      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.

        Attachments

          Activity

            People

            • Assignee:
              aaime Andrea Aime [Administrator]
              Reporter:
              aaime Andrea Aime [Administrator]
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: