ruscomap/public/js/mapInit.js

19 lines
656 B
JavaScript
Raw Normal View History

2024-08-25 15:09:27 +02:00
// 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
2024-09-21 00:36:00 +02:00
export function mapInit() {
const coordsPiazzaMaggiore = [44.49385, 11.34316];
2024-09-21 01:11:50 +02:00
const map = L.map("map").setView(coordsPiazzaMaggiore, 13);
2024-06-30 22:56:19 +02:00
2024-09-21 00:36:00 +02:00
L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
2024-06-30 22:56:19 +02:00
maxZoom: 19,
2024-09-21 00:36:00 +02:00
attribution:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(map);
2024-06-30 22:56:19 +02:00
2024-09-21 00:36:00 +02:00
L.control.locate().addTo(map);
2024-08-25 15:09:27 +02:00
2024-09-21 00:36:00 +02:00
return map;
2024-08-25 15:09:27 +02:00
}