Use svg as a map using leaflet.js

Can I use an SVG image as a base map for leaflet.js?

In my case, I have a huge svg file, and I want my users to be able to use all the functions of the flyer, such as scaling, markers, layers.

+7
javascript svg leaflet
source share
1 answer

Yes, you can just use imageOverlay , for example

var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg', imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]]; L.imageOverlay(imageUrl, imageBounds).addTo(map); 

Here is a jsfiddle example for an example: http://jsfiddle.net/rimig/86o3h89m/

+10
source share

All Articles