I am looking for a way to have a fuzzy/blur/gradient outline of a leaflet polygon.
This should help make country outlines more simple (currently, when you zoom in to a svg representing a country, it gets ugly/inaccurate).
I was thinking about attaching CSS attributes to the svg similiar to this: http://www.w3schools.com/svg/svg_fegaussianblur.asp
But apparently the svg subelement <g>
(used for the leaflet polygon) does not accept this.
I also had a look at <defs>
of svg (see here: http://geoexamples.blogspot.be/2014/01/d3-map-styling-tutorial-ii-giving-style.html) but have no clue in applying this to leaflet.
You would first need to put the actual
filter
element into thesvg
element of the map, otherwise assigning a filter to apath
org
won't work because the filter will be undefined. So you're going to need to do this in Javascript. But assigning a filter by classname in CSS is as far as i can see impossible because it will only work with theurl()
function of CSS. That won't fly with the dynamic SVG embedded in Leaflet's overlaypane. You can however assign it with Javascript:After that you can use the filter on polygons, linestrings, etc:
That's it, here's a working example on Plunker: http://plnkr.co/edit/JTNgeXuiBaL8LIbmkVjz?p=preview