mapnik / mapnik-support

Use the issues queue here to ask questions and offer help on using Mapnik (maybe if this works well we can retire the mailing list at http://mapnik.org/contact/?)
6 stars 6 forks source link

<symbol>/<use> not supported in SVG PointSymbolizer? #90

Closed hholzgra closed 7 years ago

hholzgra commented 7 years ago

looks as if s referenced by are not supported when using SVG images with PointSymbolizer / ShieldSymbolizer?

Is this indeed an unsupported SVG feature, or am I simply doing it wrong?

As an example I rendered a GPX path with Waypoints, using a SVG that has a black square background and a smaller white square foreground.

The style for waypoings is as simple as possible:

With a "simple" SVG the result looks as expected:

http://osm-baustelle.de/simple.png

but when the white square is defined as a SVG and referenced by a xlink only the black background square gets rendered:

http://osm-baustelle.de/symbol-use.png

The actual SVG files look exactly the same in the browser:

http://osm-baustelle.de/simple.svg http://osm-baustelle.de/symbol-use.svg

In this example it would be easy to just replace the with the actual path, in the actual use case the s in the SVG are glyph paths auto-generated by Cairo/Pango which are referenced with an x/y offset, and potentially multiple times.

So post-processing the auto-generated SVG images would be a bit more complicated than just moving lines to a different part of the file.

springmeyer commented 7 years ago

<symbol> and <use> are not currently supported, see https://github.com/mapnik/mapnik/issues/763 and https://github.com/mapnik/mapnik/issues/3181

artemp commented 7 years ago

@hholzgra - Initial support for <use> element added in https://github.com/mapnik/mapnik/tree/svg-strict-parsing (https://github.com/mapnik/mapnik/issues/763). As a side-effect <symbol> elements are rendered too (at least in case of http://osm-baustelle.de/symbol-use.svg when <symbol> is inside <def></def>) but this still needs more work. Leaving this issue open to track <symbol> support.

/cc @springmeyer

springmeyer commented 7 years ago

but this still needs more work. Leaving this issue open to track support.

@artemp can you share what still needs work / is unsupported?

Also, should we track achieving full <symbol> here or https://github.com/mapnik/mapnik/issues/3181?

artemp commented 7 years ago

<symbol> needs implementing. The fact that it sometimes works already is just a byproduct of implementing <use>.

Lets move this to mapnik/mapnik#3181 , closing. /cc @springmeyer