Closed pnorman closed 7 years ago
Inlining every symbols will significantly blow up the file sizes so it will only be feasible for patterns with relatively few and simple symbols. But good to know this would be a requirement for use directly in Mapnik.
I am not too sure how useful svg patterns would actually be for direct use in rendering - much more useful would be if there was support for using grayscale pattern images to generate the actual pattern from the style.
Inlining of symbols is now possible but not tested in mapnik yet.
A script is now available that converts jsdotpattern SVGs into a Mapnik compatible form using inkscape. This is fairly ugly but there is no reasonable way to directly generate Mapnik compatible SVGs from within Snap (or other JS SVG libraries).
Apparently if the SVG content does not fully fill the bounding box Mapnik performs some kind of transform to the pattern that can break periodicity - see https://github.com/gravitystorm/openstreetmap-carto/pull/2685
You can work around this by using symbol offsets so the pattern symbols cross all edges of the bounding box but it should be possible to work around this from svg_pattern.sh by adding an invisible dummy geometry.
I hope this is now finally done by adding a dummy geometry in svg_pattern.sh
.
Mapnik cannot make use of SVGs with
<use/>
to my knowledge. This is annoying, but unlikely to change by 3.0 release. A mode to generate a SVG without would be useful.This does not matter with currently released versions of Mapnik, which do not support SVGs for polygon-patterns at all, and the output of this tool is extremely unlikely to be used with a point symbolizer.