-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
231 lines (204 loc) · 8.68 KB
/
test.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Mkuranga Land Value Rates</title>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.css' rel='stylesheet' />
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
</head>
<body>
<style>
#features {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 300px;
overflow: auto;
background: rgba(255, 255, 255, 0.8);
color: black;
}
.mapboxgl-popup {
max-width: 800px !important;
color: black;
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
</style>
<div class="sidebar pad2" style="color: white;">
<div id="details_mk">
<h1>Mkuranga Land Rates</h1>
<b></b>
<p>Mkuranga is one of the six districts of Pwani Region in Tanzania. It is bordered to the north by Dar es Salaam, to the east by the Indian Ocean, to the south by Rufiji District, and to the west by Kisarawe District.</p>
<b></b>
<p>The map on the right pane provides details of land rates per square meter(/sqm).</p>
<button id="_unsurvey btn btn-primary align-center" onclick="addDetail">Test</button>
<p id="test"></p>
</div>
</div>
<div id="map" class="map pad2"></div>
<!-- <pre id="features"></pre> -->
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.js'></script>
<script>
mapboxgl.accessToken = 'pk.eyJ1Ijoid2tpbWFjaGEiLCJhIjoiY2ptMGNybngzMGIzcTNrcXk2ZGppYnJjMCJ9.j60shrPtcsdeIPbjDInrGQ';
// This adds the map to your page
var map = new mapboxgl.Map({
// container id specified in the HTML
container: 'map',
// style URL
style: 'mapbox://styles/wkimacha/cjul13o7n1n2y1fnw9md4fto9',
// initial position in [lon, lat] format
center: [39.225, -7.27],
// initial zoom
zoom: 9.32,
// pitch
pitch: 45,
//bearing
bearing: -17.6,
// anti-alias
antialias: true
});
map.on('click','mkuranga',function(e){
// var features = map.queryRenderedFeatures(e.);
// map.getCanvas().style.cursor = 'pointer';
// var village = e.features[0].properties.Village_N;
// var coordinates = e.features[0].geometry.coordinates.slice();
new mapboxgl.Popup()
.setLngLat(e.LngLat)
var p = e.feature.propperties;
var tabs = document.createElement('div');
tabs.className = 'tabs-ui';
for (var key in p) {
var tab = document.createElement('div');
tab.className = 'tab';
var input = document.createElement('input');
input.type = 'radio';
input.id = edify(key);
input.name = 'tab-group';
if (key === 'Vil_Mtaa_N') input.setAttribute('checked',true);
tab.appendChild(input);
tab.innerHTML += '<label for='+ idify(key) + key + '</label>' +
'<div class="content">' + p[key] + '</div>';
tabs.appendChild(tab);
}
// new mapboxgl.Popup()
// .setLngLat(e.lngLat)
// .setHTML(`
// <div class="w3-bar w3-black">
// <button class="w3-bar-item w3-button unsurvey_" id="unsurvey_" onClick=openSurvey('Unsurveyed')>Unsurveyed</button>
// <button class="w3-bar-item w3-button survey_" onClick=openSurvey('Surveyed')>Surveyed</button>
// </div>
// <div id="Unsurveyed defaultOpen">
// <table class="Un_surveyed_table">
// <tr>
// <td colspan="3"><b>${e.features[0].properties.Vil_Mtaa_N} Land Value Rates</b></td>
// </tr>
// <tr>
// <td>Name of Ward</td>
// <td>:</td>
// <td>${e.features[0].properties.Ward_Name}</td>
// </tr>
// <tr>
// <td colspan="3"><b>Unsurveyed:</b></td>
// </tr>
// <tr>
// <td>Residential</td>
// <td>:</td>
// <td>${e.features[0].properties.un_res}Tshs</td>
// </tr>
// <tr>
// <td>Commercial</td>
// <td>:</td>
// <td>${e.features[0].properties.un_com}Tshs</td>
// </tr>
// <tr>
// <td>Residential/Commercial</td>
// <td>:</td>
// <td>${e.features[0].properties.un_rescom}Tshs</td>
// </tr>
// <tr>
// <td>Institution</td>
// <td>:</td>
// <td>${e.features[0].properties.un_insti}Tshs</td>
// </tr>
// <tr>
// <td>Industrial</td>
// <td>:</td>
// <td id="un_indust">${e.features[0].properties.un_indust}Tshs</td>
// </tr>
// </table>
// </div>
// <!-- Un_surveyed -->
// <div id="Unsurveyed">
// <table class="Un_surveyed" style="display:none">
// <tr>
// <td colspan="3"><b>${e.features[0].properties.Vil_Mtaa_N} Land Value Rates</b></td>
// </tr>
// <tr>
// <td>Name of Ward</td>
// <td>:</td>
// <td>${e.features[0].properties.Ward_Name}</td>
// </tr>
// <tr>
// <td colspan="3"><b>Unsurveyed:</b></td>
// </tr>
// <tr>
// <td>Residential</td>
// <td>:</td>
// <td>${e.features[0].properties.un_res}Tshs</td>
// </tr>
// <tr>
// <td>Commercial</td>
// <td>:</td>
// <td>${e.features[0].properties.un_com}Tshs</td>
// </tr>
// <tr>
// <td>Residential/Commercial</td>
// <td>:</td>
// <td>${e.features[0].properties.un_rescom}Tshs</td>
// </tr>
// <tr>
// <td>Institution</td>
// <td>:</td>
// <td>${e.features[0].properties.un_insti}Tshs</td>
// </tr>
// <tr>
// <td>Industrial</td>
// <td>:</td>
// <td>${e.features[0].properties.un_indust}Tshs</td>
// </tr>
// </table>
// </div>
// `)
// .addTo(map);
// });
// $("body").on("click", "#test", function(e){
// alert(addDetail);
// });
// function addDetail(){
// document.getElementById("un_indust").innerHTML +=
// "<p>${e.features.[0].properties.un_indust}</p>";
// }
// $("body").on("click", "#unsurvey_", function(e){
// alert(${e.features[0].properties.un_indust});
// });
// function openSurvey(cityName) {
// var i;
// var x = document.getElementsByClassName("Un_surveyed");
// for (i = 0; i < x.length; i++) {
// x[i].style.display = "none";
// }
// document.getElementById(cityName).style.display = "block";
// }
// document.getElementById("defaultOpen").click();
map.on('mouseenter', 'mkuranga', function () {
map.getCanvas().style.cursor = 'pointer';
});
map.on('mouseleave', 'mkuranga', function () {
map.getCanvas().style.cursor = '';
});
// });
</script>
</body>
</html>