-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
234 lines (166 loc) · 5.2 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<html>
<head>
<title>Nepal</title>
<meta charset="utf-8" />
<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>
<script src="jquery-3.1.1.min.js"></script>
<script src="leaflet.ajax.min.js"></script>
<link rel="stylesheet" href="L.Control.ZoomMin.css" media="screen">
<script src="L.Control.ZoomMin.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/bbecquet/Leaflet.MagnifyingGlass/master/leaflet.magnifyingglass.css" />
<script src="https://cdn.rawgit.com/bbecquet/Leaflet.MagnifyingGlass/leaflet-0.7.2/leaflet.magnifyingglass.js"></script>
<link rel="stylesheet" type="text/css" href="imgslider.min.css">
<script type="text/javascript" src="imgslider.min.js"></script>
<style>
/* Map Styles and Dimensions */
.map{ height: 100%;
width: 100%}
#map {
margin: 0 auto;
text-align: left;
width: 900px;
height: 700px;
}
.slider{
width: 600px;
height:600px;
margin: 0 auto}
/* Remove border of map */
.leaflet-container {
background-color:rgba(255,0,0,0.0);
}
.leaflet-touch .leaflet-bar {
border: none;
}
<!-- .h1 { -->
<!-- font-family: Sans Serif; -->
<!-- margin: 0 auto;} -->
h1 {
text-align: center;
font-family: Sans-Serif;}
.info {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.8);
/* box-shadow: 0 0 15px rgba(0,0,0,0.2); */
border-radius: 5px;
}
.info h4 {
margin: 0 0 5px;
color: #777;
}
</style>
</head>
<body>
<h1>
Hover Over Map
</h1>
<div id="map"></div>
<script>
// initialize the map + minimum zoom if just focusing on one country
var map = L.map('map',{minZoom: 7, maxZoom: 7,attributionControl: false,zoomControl: false}).setView([23.814602, 90.413961], 12);
// Add zoom to extent button (see stylesheet and .js file in header)
<!-- map.addControl(new L.Control.ZoomMin()) -->
//Setting Maximum bounds for zooming and panning (Top left and bottom right from google maps)
var bounds = L.latLngBounds([[26.548387, 89.144284], [20.580493, 92.103854]]);
map.setMaxBounds(bounds);
map.on('drag', function() {
map.panInsideBounds(bounds, { animate: false });
});
//Load GeoJSON using Ajax Plugin (Chrome not allowing cross HTTP requests..)
var geojsonLayer = new L.GeoJSON.AJAX("Bangladesh.json",{style:style
,smoothFactor: 0}).addTo(map);
//onEachFeature:onEachFeature
// Adding GeoTiff
var RasterBounds = new L.LatLngBounds(
new L.LatLng(26.64163201,88.00822613),
new L.LatLng(20.73330104,92.67489093));
map.fitBounds(bounds);
var overlay = new L.ImageOverlay("Bangladesh4.png", RasterBounds);
var magnifyingGlass = L.magnifyingGlass({
layers: [overlay],
zoomOffset: 0,
radius: 100
}).addTo(map);
<!-- // Define Colourscheme and Variable to Symbolise -->
function getColor(tFGT_0) {
return tFGT_0 > 0.71 ? '#084594' :
tFGT_0 > 0.53 ? '#2171b5' :
tFGT_0 > 0.47 ? '#4292c6' :
tFGT_0 > 0.41 ? '#6baed6' :
tFGT_0 > 0.34 ? '#9ecae1':
'#9ecae1';}
<!-- } -->
// Define Style differences for when feature is hovered over
function style(feature) {
return {
fillColor: getColor(feature.properties.tFGT_0) ,
weight: 0,
opacity: 1,
color: 'black',
fillOpacity: 1
};
}
<!-- function highlightFeature(e) { -->
<!-- var layer = e.target; -->
<!-- layer.setStyle({ -->
<!-- weight: 2, -->
<!-- color: '#777', -->
<!-- dashArray: '', -->
<!-- fillOpacity: 0.7 -->
<!-- }); -->
<!-- if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) { -->
<!-- layer.bringToFront(); -->
//info.update(layer.feature.properties);
<!-- } -->
<!-- } -->
<!-- function resetHighlight(e) { -->
<!-- geojsonLayer.resetStyle(e.target); -->
<!-- } -->
<!-- function zoomToFeature(e) { -->
<!-- map.fitBounds(e.target.getBounds()); -->
<!-- } -->
<!-- function resetHighlight(e) { -->
<!-- geojsonLayer.resetStyle(e.target); -->
<!-- info.update(); -->
<!-- } -->
<!-- function onEachFeature(feature, layer) { -->
<!-- layer.on({ -->
<!-- mouseover: highlightFeature, -->
<!-- mouseout: resetHighlight, -->
<!-- click: zoomToFeature -->
<!-- }); -->
<!-- } -->
var info = L.control();
<!-- info.onAdd = function (map) { -->
<!-- this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info" -->
<!-- this.update(); -->
<!-- return this._div; -->
<!-- }; -->
// Update the control based on feature properties passed
info.update = '<h4>Food Poverty Estimate</h4><p>';
info.addTo(map);
//Remove attribution in bottom right
document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';
</script>
<div>
<br/><br/><br/>
<h1> Dakar - Before and After </h1>
</div>
<div class="slider">
<div class="slider responsive">
<div class="left image">
<img src="Dakar_without.png"/>
</div>
<div class="right image">
<img src="Dakar_PPI.png"/>
</div>
</div>
</div>
</body>
<script>
$('.slider').slider({ instructionText:"Drag!" });
</script>
</html>