ruscomap/public/js/mapInit.js
2024-09-21 01:11:50 +02:00

18 lines
656 B
JavaScript

// import L from './../node_modules/leaflet'; // Import Leaflet
// import '../../node_modeules/leaflet.locatecontrol'; // Import the Locate Control plugin
// import '../../node_modeules/leaflet.locatecontrol/dist/L.Control.Locate.min.css'; // Import styles
export function mapInit() {
const coordsPiazzaMaggiore = [44.49385, 11.34316];
const map = L.map("map").setView(coordsPiazzaMaggiore, 13);
L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19,
attribution:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(map);
L.control.locate().addTo(map);
return map;
}