-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path6M.html
90 lines (74 loc) · 1.6 KB
/
6M.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title>Leaflet GeoJSON Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="leaflet.css" />
<script src="https://npmcdn.com/axios/dist/axios.min.js"></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="leaflet.js"></script>
<script>
var allStyle = {
"color": "#ff7800",
"weight": 1,
"opacity": 0.65
};
var kosovoStyle = {
"color": "#000000",
"weight": 1,
"opacity":1
};
var palestineStyle = {
"color": "#000000",
"weight": 1,
"opacity": 1
};
var map = L.map('map').setView([0, 0], 3);
mapLink =
'<a href="http://openstreetmap.org">OpenStreetMap</a>';
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© ' + mapLink + ' Contributors',
maxZoom: 18,
}).addTo(map);
function createLayer(data,st){
L.geoJson(data,{style:st}).addTo(map)
}
axios.get('countries6M.json')
.then(function (response) {
createLayer(response.data,allStyle)
})
.catch(function (error) {
console.log(error);
});
axios.get('kosovo.json')
.then(function (response) {
createLayer(response.data,kosovoStyle)
})
.catch(function (error) {
console.log(error);
});
axios.get('palestine.json')
.then(function (response) {
createLayer(response.data,palestineStyle)
})
.catch(function (error) {
console.log(error);
});
//L.geoJson().addTo(map);
</script>
</body>
</html>