If one wants to give a SVG <text>
an outline effect, e.g. so it can be
displayed on many different backgrounds (any color, dark, bright, patterns…),
there are various approaches. In this demo three are shown (the first two are
very similar though):
Example 1: Two <text>
elements, the one with white thick stroke behind
the other one.
Example 2: Similar to the previous example only here is only one <text>
element and instead the paint-order
attribute is used so the stroke is
painted behing the fill. This attribute is not part of SVG 1.1 though and
not supported by browsers such as Internet Explorer 11 or Microsoft Edge
(as of EdgeHTML version 15).
Example 3: A <filter>
with multiple filter effects merged inside in
order to achieve the effect.
Panning/Zooming on the map is possible (e.g. using the mouse).
Additionally, there are various controls to test the behaviors especially in very dynamic applications.
A link can be created to start at a certain camera position or with certain default values. How to do it is left as an exercise to the reader.
Updated missing url https://cdn.rawgit.com/jerrybendy/url-search-params-polyfill/357fd6bf/index.js to https://cdn.jsdelivr.net/gh/jerrybendy/url-search-params-polyfill/357fd6bf/index.js
https://d3js.org/d3.v4.js
https://cdn.rawgit.com/jerrybendy/url-search-params-polyfill/357fd6bf/index.js