Skip to content

Commit 227ff58

Browse files
authored
mappa
1 parent b711136 commit 227ff58

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

public/maps/gubbio.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html lang="it">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Mappa con geolocalizzazione</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
8+
<!-- Mapbox CSS -->
9+
<link href="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css" rel="stylesheet">
10+
<style>
11+
body, html { margin:0; padding:0; height:100%; }
12+
#map { width:100%; height:100%; }
13+
</style>
14+
</head>
15+
<body>
16+
<div id="map"></div>
17+
18+
<!-- Mapbox JS -->
19+
<script src="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js"></script>
20+
<script>
21+
mapboxgl.accessToken = 'pk.eyJ1IjoiZGlzY292ZXJ5Z3ViYmlvIiwiYSI6ImNtZWw1aTZudjBibGsybXM2ejdtNndmbmUifQ.bwUtB5uwtdwiuK94K-8ZHw';
22+
23+
const map = new mapboxgl.Map({
24+
container: 'map',
25+
style: 'mapbox://styles/mapbox/streets-v12',
26+
center: [12.4964, 41.9028], // Roma di default
27+
zoom: 14
28+
});
29+
30+
map.addControl(new mapboxgl.NavigationControl());
31+
32+
const geolocate = new mapboxgl.GeolocateControl({
33+
positionOptions: { enableHighAccuracy: true },
34+
trackUserLocation: true,
35+
showUserHeading: true
36+
});
37+
38+
map.addControl(geolocate);
39+
40+
map.on('load', () => {
41+
geolocate.trigger();
42+
});
43+
</script>
44+
</body>
45+
</html>

0 commit comments

Comments
 (0)