ruscomap/public/js/mapInit.js

21 lines
636 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-06-30 22:56:19 +02:00
export function mapInit(){
const coordsPiazzaMaggiore = [44.49385, 11.34316]
var 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);
2024-08-25 16:42:50 +02:00
L.control.locate().addTo(map);
2024-08-25 15:09:27 +02:00
2024-06-30 22:56:19 +02:00
return map;
2024-08-25 15:09:27 +02:00
}