-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
73 lines (59 loc) · 1.94 KB
/
index.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Map</title>
<meta charset="utf-8">
<!-- Load Leaflet from CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 90%;
width: 100%;
}
</style>
</head>
<body>
<div>
<p class="is-size-2 has-text-centered">1 kilometre autour de chez vous</p>
<p class="is-size-6 has-text-centered">cliquez ou vous habitez</p>
</div>
<div id="map"></div>
<p class="is-size-6 has-text-right is-italic">Enjoy ! </p>
<script>
//map
var map = L.map('map').setView([46.679594,1.966553], 6);
var assetLayerGroup = new L.LayerGroup();
var redIcon = L.icon({
iconUrl: 'redIcon.png',
shadowUrl: 'marker-shadow.png',
iconAnchor: [12, 41] //[iconWidth/2, iconHeight]
});
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
map.on('click', function(e) {
addMarker(e);
add_1km_circle(e);
} );
function addMarker(e){
myLoc = e.latlng;
locationMarker = L.marker(e.latlng, {icon: redIcon}).addTo(map);
assetLayerGroup.addLayer(locationMarker);
}
function add_1km_circle(e){
myLoc = e.latlng;
circle1km = L.circle(e.latlng, {radius: 1000}).addTo(map);
assetLayerGroup.addLayer(circle1km);
}
</script>
</body>