L.Marker.AutoResizeSVG

A Leaflet plugin for automatic marker resizing based on zoom level: SVG Edition

Get the plugin

The most up to date code is found in marker-resize-svg.js located at the github repo. Currently tested with Leaflet v0.7.7 & v1.0.0-rc.1.

Example

View the example on a separate page here.

Include the plugin in the head section of your page


<script src="/path/to/marker-resize-svg.js"></script>
		

Create the specialized icon


var myIcon = L.icon({
	iconUrl: 'StatementFloodOutlineHaloed.svg',
	iconSizeArray: // Three zoomed sizes of the SVG
	[
		[32, 32], [96, 96], [256, 256]
	],
	iconAnchorArray: // The corresponding anchor points
	[
		[16, 32], [48, 96], [128, 256]
	]
})

Params:
All standard L.Icon params are available, simply
append 'Array' and provide an array of 3 objects.
		

Create a marker

Required option is icon, an instance of L.Icon like ours above.


L.autoResizeMarkerSVG([42.486, -71.236], {icon: myIcon).addTo(mymap);