SVG markers are not placed on the center of the SVG marker #1122

olt opened this Issue Mar 9, 2012 · 5 comments

3 participants

olt commented Mar 9, 2012

Right now SVG markers are placed on the center of the SVG object itself. (Mapnik calculates the bounding rect of all paths of the SVG). That way SVG markers are always centered, but this makes it impossible to place arrow like markers to point to an exact location.

A simple solution to place arrow-like markers is to create a larger SVG canvas and point the tip of the arrow to the center of the large canvas. That does work great with OpenLayers or MapFish Print, but not with Mapnik.
I did a quick hack to read the actual SVG canvas size from the XML, instead of calculating it, and it works great. See here:

Unfortunately, the bounding rects are calculated inside the marker cache, so it is not easy to make this an option for the PointSymbolizer. Or am I missing something? What would be the best way to add this behavior?

Mapnik member

Thanks for the patch! I see the problem. Looks like we might need different 'lazy' strategies for bounding box calculation.

Mapnik member

@artemp - see also #1137 when you get a chance to dig into this one.

Mapnik member


Mapnik member

work above added that starts to parse width/height. TODO - need to also look into getting viewBox and then considering doing something with this into/adding options.

Mapnik member

some of the work added in 76042a1 rolled back after fixing the regression as detailed at #1849

@PetrDlouhy PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013
@springmeyer springmeyer parse and setup ability to known original, declared svg width/height …
…- refs #1122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment