let map = null; let mapImg = null; function initializeMap(mapImgUrl) { if (!map) { map = L.map('map', { minZoom: 0, maxZoom: 4, crs: L.CRS.Simple }); } if (mapImg) { mapImg.removeFrom(map); } mapImg = L.imageOverlay(mapImgUrl, [[-180, 180],[180, -180]]); mapImg.addTo(map); map.setMaxBounds([[-180,180],[180,-180]]); map.setView([0,0], 2); }