-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaptest.html
59 lines (43 loc) · 2.93 KB
/
maptest.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
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw=="
crossorigin=""></script>
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<!-- <script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.heat/0.2.0/leaflet-heat.js'></script> -->
<script>
data= [{"ID":1,"CO":"NaN","lng":46.52509694,"lat":24.991677},{"ID":2,"CO":"NaN","lng":46.86895561,"lat":24.751133},{"ID":3,"CO":"NaN","lng":46.8973684,"lat":24.383645},{"ID":4,"CO":"NaN","lng":46.52977292,"lat":24.774485},{"ID":5,"CO":0.540063,"lng":46.78124785,"lat":24.592577},{"ID":6,"CO":0.545832,"lng":46.69993581,"lat":24.568516},{"ID":7,"CO":"NaN","lng":46.75168406,"lat":24.676744},{"ID":8,"CO":0.677936,"lng":46.72154097,"lat":24.649445},{"ID":9,"CO":"NaN","lng":46.6546968,"lat":24.579192},{"ID":10,"CO":0.466214,"lng":46.67172574,"lat":24.757516},{"ID":11,"CO":"NaN","lng":46.77346541,"lat":24.762383},{"ID":12,"CO":1.768642,"lng":46.75706742,"lat":24.72364},{"ID":13,"CO":1.082063,"lng":46.67924518,"lat":24.699848},{"ID":14,"CO":1.493479,"lng":46.70332914,"lat":24.685063},{"ID":15,"CO":1.238802,"lng":46.64502545,"lat":24.760223},{"ID":16,"CO":2.239242,"lng":46.74502415,"lat":24.598403},{"ID":17,"CO":0.363903,"lng":46.81790693,"lat":24.58304}];
console.dir(data);
(function() {
const cScope = this.scope;
setTimeout(function () {
var map;
var token = L.mapbox.accessToken = 'pk.eyJ1IjoiYWxtYWhhIiwiYSI6ImM4M2YxY2U3ZDVhNTg3YjdkZWI0MDRkNmU5YzU5NWI4In0.5g65rHetoEtp1RqK8t2gsA';
var mapKey = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=' + token;
map = L.mapbox.map('mapid', 'mapbox.light', {zoomControl:false}).setView([24.6454, 46.6294],10);
L.tileLayer(mapKey, {id: 'mapbox.light'}).addTo(map);
map.on('click', function(e) {
cScope.send(e.latlng);
if (marker) {
map.removeLayer(marker);
};
marker = L.circleMarker(e.latlng).addTo(map);
});
//cScope.$watch('msg.payload', function(data) {
setTimeout(function() {
console.dir(data);
for (var i = 0; i < data.length; i++) {
L.marker([data[i].lat, data[i].lng]).addTo(map);
console.log(data[i].lng, data[i].lat);
}
});
setTimeout(function () {
map.invalidateSize();
}, 100);
}, 300);
})();
</script>
<div id="mapid" style="width: 100%; height: 100%;"></div>
<!--<div>{{msg.payload}}</div>-->