Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Open
olt opened this Issue · 5 comments

3 participants

@olt
olt commented

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:
olt@3f6cf0f

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?

@artemp
Owner

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

@springmeyer
Owner

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

@springmeyer
Owner

bump

@springmeyer
Owner

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.

@springmeyer
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.