JLyne / LiveAtlas

A Dynmap, Squaremap, Pl3xmap and Overviewer frontend for the modern web
Apache License 2.0
339 stars 36 forks source link

How do I add custom `leaflet.js` overlays? #576

Open Kinboise opened 1 year ago

Kinboise commented 1 year ago

I have a manually drawn .svg file (not from Dynmap) with a lot of markers (road names, etc.), and I want to use it as a leaflet.js overlay with these code:

var svgElement = document.getElementById('svg');
var latLngBounds = L.latLngBounds([[-7200,-2560], [2336,2560]]);
map.fitBounds(latLngBounds);

var svgOverlay = L.svgOverlay(svgElement, latLngBounds, {
opacity: 1.0,
interactive: false
}).addTo(map);

Where should I put these code to make it work? Thanks!