-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (139 loc) · 4.15 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Sykes-Picot interactive map</title>
<!-- jQuery -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
<!-- Underscore -->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore.js"></script> -->
<!-- Leaflet -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<!-- Leaflet plugins -->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet-providers/1.0.7/leaflet-providers.js"></script> -->
<!-- D3 -->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.12/d3.js"></script> -->
<script>
my = {}
my.map = null;
</script>
<style>
body, html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#map-container {
height: 100%;
width: 100%;
}
#map {
height: 100%;
width: 100%;
background: #eee;
}
#hint {
position: absolute;
top: 10px;
right: 10px;
color: #c33;
font-family: sans-serif;
font-weight: bold;
background: white;
border-top-left-radius: 18px;
border-bottom-left-radius: 18px;
line-height: 36px;
padding-left: 1em;
padding-right: calc(0.75em + 36px);
transform: translate3d(200px, 0, 0);
-webkit-transform: translate3d(200px, 0, 0);
transition: all 0.25s;
-webkit-transition: all 0.25s;
}
#hint.ready {
transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
}
</style>
</head>
<body>
<div id="map-container">
<div id="map"></div>
</div>
<div id="hint">Map options<!-- → --></div>
<script>
$(function(){
// create the map
my.map = L.map('map', {
minZoom: 5,
maxZoom: 9,
}).setView([34, 42], 5)
// create base map layers using Leaflet providers
var esri = L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ',
maxZoom: 16
});
var osm = L.tileLayer('http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
// set default base map
esri.addTo(my.map);
// add the scanned map as a tile set
var scanBounds = [[28.63153408, 31.31328073], [42.55400735, 51.15800009]]
var scan = L.tileLayer('tiles/Z{z}/{y}/{x}.png', {
minZoom: 3,
maxZoom: 8,
errorTileUrl: 'tiles/empty.png',
bounds: scanBounds
}).addTo(my.map);
my.map.fitBounds(scanBounds);
// fetch the json data for the digitized boundaries
var boundaries;
$.getJSON( "sp.geojson", function( data ) {
// console.log(data)
boundaries = L.geoJson(data, {
style: function (feature) {
var color = 'black',
dashArray = 'none';
if (feature.properties.style.indexOf('red') >= 0) {
color = 'red';
} else if (feature.properties.style.indexOf('blue') >= 0) {
color = 'blue';
}
if (feature.properties.style.indexOf('dashed') >= 0) {
dashArray = '10,10';
}
return {weight: 2, color: color, dashArray: dashArray};
},
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.desc);
}
}).addTo(my.map);
// add layer control
var baseLayers = {
"Detailed base map": osm,
"Simple base map": esri,
};
var overlays = {
"Sykes-Picot boundaries": boundaries,
"Sykes-Picot scan": scan,
};
L.control.layers(baseLayers, overlays).addTo(my.map);
$('#hint').addClass('ready');
});
})
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65146654-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>