MS RFC 73: Improved SVG symbols support¶
|Authors:||Zak James (zjames at dmsolutions.ca)|
|Authors:||Yewondwossen Assefa (yassefa at dmsolutions.ca)|
The SVG format offers several advantages over existing mapserver symbol types but existing support is limited. We propose the implementation of complete support using the libsvg-cairo library, part of the cairo project.
All renderers will be extended with an added supports_svg flag, set to 0 for all but the cairo renderer. When an SVG symbol is requested, other renderers will trigger a call to msRenderSVGToPixmap which will parse the referenced svg file (using libsvg-cairo) and render the svg into the symbol’s pixmapbuffer using cairo. After this operation, normal pixmap symbol handling will be used.
For the cairo renderer, the renderSVGSymbolCairo function will use libsvg-cairo to parse the symbol, but will then use the cairo api to render the symbol directly.
Configure.in will be modified to detect the –with-libsvg-cairo configure option and define USE_LIBSVG_CAIRO.
Existing Partial Implementation¶
If this rfc is adopted the existing SVG symbol code (see https://github.com/mapserver/mapserver/issues/3343) would be superceeded and would be removed.
The proposed implementation will reuse the existing changes to the parser but the approach for reading and rendering the symbols would be different. It will use an existing SVG parser which includes a more complete SVG implementation and will pass through the SVG instructions directly in the case of a cairo (pdf or postscript) outputformat to improve quality. Additionally, this version will pre-scale and rotate the SVG before rasterizing with agg to avoid bitmap artifacts.
SYMBOL NAME "svgsymbol" TYPE SVG IMAGE "/path/to/symbol.svg" END
... once defined, the symbol is used within the mapfile like any other.
Backwards Compatibility Issues¶
There are no compatibility issues with existing mapfiles. The SVG symbol type is already allowed within a SYMBOLSET. SVG Symbol support will be disabled by default. Enabling it will require installation of the libsvg-cairo library available from * http://cairographics.org/snapshots/libsvg-cairo-0.1.6.tar.gz
+1 from DanielM, SteveW, ThomasB, SteveL, MichaelS, AssefaY