Demonstrates how to load SVG's as Leaflet icons via the data URI method.
Following was helpful to figure this out:
- Optimizing SVGs in Data URIs
- http://codepen.io/gabrien/pen/NqGvGq
- http://codepen.io/chriscoyier/pen/ZQgvyG/
This block is a modified example taken from Working with spatial data.
Built with blockbuilder.org
forked from enjalot's block: WWSD #1: Leaflet starter
forked from enjalot's block: WWSD #1: Leaflet starter
Thanks for the code. For others reading this, I found the following works better (for me at least) than encodeURI:
var url = "data:image/svg+xml," + encodeURIComponent(svg);
This allow double-quotes in the SVG and no need to do the additional replace on hashes.