-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhtml mapas.txt
39 lines (31 loc) · 1.13 KB
/
html mapas.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<head>
<title>GeoJSON + Flask + MongoDB</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<h1>
Let's display some nice maps here!
</h1>
<div id="map" style="height: 80vh;"></div>
<script>
var map = L.map('map').setView([45.505, -5.09], 6)
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
map.panTo(L.latLng(position.coords.latitude, position.coords.longitude))
})
}
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: 'Open street map'
}).addTo(map)
axios.get('http://127.0.0.1:5000/geojson-features')
.then(response => {
console.log(response.data)
L.geoJSON(response.data, {}).addTo(map);
})
</script>
</body>
</html>