-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvisualize.html
559 lines (482 loc) · 26.1 KB
/
visualize.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!DOCTYPE HTML>
<!--
Verti by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>geoBoundaries</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/ol.css" type="text/css">
<link rel="stylesheet" href="assets/css/geoContrast.css" />
<link rel="stylesheet" href="assets/css/main.css" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-9276981-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-9276981-3');
</script>
<!-- Global site tag (gtag.js) - Google Ads: 984002936 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-984002936"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-984002936');
</script>
<!-- Event snippet for Website traffic conversion page -->
<script>
gtag('event', 'conversion', {'send_to': 'AW-984002936/BycZCJ_8kdMBEPjimtUD'});
</script>
</head>
<body class="is-preload right-sidebar">
<div id="page-wrapper">
<!-- Header & Nav -->
<div id="header-wrapper">
<header id="header" class="container">
<!-- Logo -->
<div id="logo">
<h1><a href="index.html">geoBoundaries</a></h1>
<span><a href="http://geolab.wm.edu">@ William & Mary</a></span>
</div>
<nav id="nav">
<ul>
<li>
<a href="visualize.html">Visualize Data</a>
</li>
<li>
<a href="index.html#features-wrapper">Download Data</a>
</li>
<li>
<a href="api.html">API</a>
</li>
<li>
<a href="contribute.html">Get Involved</a>
</li>
</ul>
</nav>
</header>
</div>
<!-- Main -->
<div id="main-wrapper">
<div class="container">
<div class="row gtr-200">
<div class="col-12 col-12-medium">
<div id="content">
<!-- Content -->
<article>
<h2>Visualize & Compare Boundaries</h2>
<div id="map-and-toolbox-div" class="row" style="width:100%; margin-left:0; margin-bottom:25px">
<div class="col-7 col-12-medium" style="padding-left:0">
<div id="fullscreen" class="fullscreen">
<div id="map" class="map">
</div>
<div style="display:none">
<!--Inside display:none to avoid being shown while waiting to be positioned-->
<div id="layer-switcher" class="ol-control-panel ol-unselectable ol-control">
<ul id="layer-list">
<li>
<!--note: checkbox class is rendered using a label checkmark character-->
<input id="toggle-layer-main" type="checkbox" style="display:none" onchange="toggleMainLayer()" checked/>
<label for="toggle-layer-main" style="margin-top:-8px; font-size:0.8em"></label>
<hr id="legend-symbol-main"></hr>
<span>Main boundary</span>
</li>
<li>
<!--note: checkbox class is rendered using a label checkmark character-->
<input id="toggle-layer-comparison" type="checkbox" style="display:none" onchange="toggleComparisonLayer()" checked/>
<label for="toggle-layer-comparison" style="margin-top:-8px; font-size:0.8em"></label>
<hr id="legend-symbol-comparison"></hr>
<span>Comparison boundary</span>
</li>
<li>
<img id="legend-symbol-basemap" src="images/1200px-Picture_icon_BLACK.svg.png"/>
<select id="select-basemap" onchange="setBaseMap(this.value)">
<option value="google" selected>Google Satellite</option>
<option value="esri">ESRI World Street Map</option>
<option value="osm">OpenStreetMap</option>
</select>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-5 col-12-medium" style="padding-left:0; ">
<div id="toolbox" class="toolbox">
<div id="tab-container" class="tab-container">
<div id="compare" class="box" style="font-size:14pt; height:600px; border-radius:0em;">
<div id="compare-main" style="height:50%">
<hr style="border-color:#319FD3; background-color:#319FD3; margin:3px; height:3px">
Compare boundaries for:
<select id="country-select" style="width:100%;display:inline;font-size:10pt;" onchange="countryChanged()">
<!--options should get dynamically populated here-->
</select>
<div style="display:flex; width:100%">
<select id="main-admin-level-select" style="width:45%;font-size:10pt;" onchange="mainAdminLevelChanged()">
<!--options should get dynamically populated here-->
</select>
<select id="main-boundary-select" style="font-size:10pt;" onchange="mainSourceChanged()">
<!--options should get dynamically populated here-->
</select>
<div id="main-boundary-upload-title" style="display:none; border-width:0; font-size:small; margin:auto auto 0px 5px">
Upload a zipped boundary shapefile.
</div>
<span id="main-boundary-upload-button" class="upload-button" onclick="mainUploadButtonPushed()" title="Upload your own boundary">
</span>
<script>
document.getElementById('main-boundary-select').onmousedown = function(event) {
openMainSourcePopup();
event.preventDefault(); // This prevents the drop-down menu from displaying
};
</script>
</div>
<div id="main-file-div" style="padding-top:5px">
<div style="display:flex; width:96%">
<div style="flex-grow:1">
<span class="fas fa-file" style="padding:0px 3px important!; margin-left:10px; width:auto">
<input id="main-file-input" class="fas" type="file" accept=".zip">
</span>
</div>
<span data-text="The file must be a *.zip file and contain at least three files: *.shp, *.shx, and *.dbf. If the *.prj file is missing, the shapefile is assumed to be in latitude-longitude (WGS84) projection." class="tooltip">
(?)
</span>
</div>
<select id="main-file-select" onchange="mainFileDropdownChanged()" style="width:90%; margin-top:10px; margin-left:20px">
</select>
</div>
<div id="main-info-div" style="padding:5px; height:60%; overflow:auto">
</div>
<div id="main-source-popup" class="popup is-hidden is-visually-hidden">
<script>
// When the user clicks anywhere outside of the popup, close it
window.addEventListener('click', function(event) {
//alert('click '+event.target.className+' '+event.target.id);
if (event.target.id == 'main-source-popup') {
//alert('should close');
event.target.className = "popup is-hidden is-visually-hidden";
};
});
</script>
<div class="popup-content" style="height:90%; font-size:medium; overflow:hidden">
<div class="box" style="height:100%">
<hr style="border-color:#319FD3; background-color:#319FD3; margin:3px; height:3px">
<h3>Select a source for the main boundary:</h3>
<div style="height:90%; overflow:auto; font-size:small">
<!--
<button>From Datasets</button>
<button>Local File</button>
-->
<table id="main-sources-table" class="table">
<thead>
<th></th>
<th>Source</th>
<th>License</th>
<th>Year</th>
<th>Updated</th>
<th>Admin. Units</th>
<th>Line Resolution</th>
<th>Vertex Density</th>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="compare-comparison" style="height:40%; margin-top:20px">
<hr style="border-color:rgb(255,0,0); background-color:rgb(255,0,0); margin:3px; height:3px">
<div style="display:flex; width:100%">
<!--<span style="">To:</span>-->
<select id="comparison-admin-level-select" style="width:45%; font-size:10pt;margin-left:3px;" onchange="comparisonAdminLevelChanged()">
<!--options should get dynamically populated here-->
</select>
<select id="comparison-boundary-select" style="font-size:10pt;" onchange="comparisonSourceChanged()">
<!--options should get dynamically populated here-->
</select>
<div id="comparison-boundary-upload-title" style="display:none; font-size:small; margin:auto auto 0px 5px">
Upload a zipped boundary shapefile.
</div>
<span id="comparison-boundary-upload-button" class="upload-button" onclick="comparisonUploadButtonPushed()" title="Upload your own boundary">
</span>
<script>
document.getElementById('comparison-boundary-select').onmousedown = function(event) {
openComparisonSourcePopup();
event.preventDefault(); // This prevents the drop-down menu from displaying
};
</script>
</div>
<div id="comparison-file-div" style="padding-top:5px">
<div style="display:flex; width:96%">
<div style="flex-grow:1">
<span class="fas fa-file" style="padding:0px 3px important!; margin-left:10px; width:auto">
<input id="comparison-file-input" class="fas" type="file" accept=".zip">
</span>
</div>
<span data-text="The file must be a *.zip file and contain at least three files: *.shp, *.shx, and *.dbf. If the *.prj file is missing, the shapefile is assumed to be in latitude-longitude (WGS84) projection." class="tooltip">
(?)
</span>
</div>
<select id="comparison-file-select" onchange="comparisonFileDropdownChanged()" style="width:90%; margin-top:10px; margin-left:20px">
</select>
</div>
<div id="comparison-info-div" style="padding:5px; height:75%; overflow:auto">
</div>
<div id="comparison-source-popup" class="popup is-hidden is-visually-hidden">
<script>
// When the user clicks anywhere outside of the popup, close it
window.addEventListener('click', function(event) {
//alert('click '+event.target.className+' '+event.target.id);
if (event.target.id == 'comparison-source-popup') {
//alert('should close');
event.target.className = "popup is-hidden is-visually-hidden";
};
});
</script>
<div class="popup-content" style="height:90%; font-size:medium; overflow:hidden">
<div class="box" style="height:100%">
<hr style="border-color:rgb(255,0,0); background-color:rgb(255,0,0); margin:3px; height:3px">
<h3>Select a source for the comparison boundary:</h3>
<!--
<button>From Datasets</button>
<button>Local File</button>
-->
<div style="height:90%; overflow:auto; font-size:small">
<table id="comparison-sources-table" class="table">
<thead>
<th></th>
<th>Source</th>
<th>License</th>
<th>Year</th>
<th>Updated</th>
<th>Admin. Units</th>
<th>Line Resolution</th>
<th>Vertex Density</th>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="compare-print-report" style="width:100%; text-align:center; margin-top:0px">
<button id="pdf-button" type="button" style="font-size:0.6em" onclick="printPageToPDF()">
Generate PDF Report
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="source-overview" class="row box" style="width:100%; margin:0px 0px; page-break-after:always; padding:0;">
<div style="width:100%;padding:0;">
<table style="table-layout:fixed; width:100%; padding:0;">
<thead style="background:#ffffff;">
<tr>
<td style="width:25%"></td>
<td style="width:37.5%">
<hr style="border-color:#319FD3; background-color:#319FD3; margin:3px; height:3px">
<h3 style="margin-bottom:0; padding-bottom:0">Main Boundary:</h3>
<span class="main-source-title" style="font-style:italic; color:gray; margin-left:15px;">None</span>
</td>
<td style="width:37.5%">
<hr style="border-color:rgb(255,0,0); background-color:rgb(255,0,0); margin:3px; height:3px">
<h3 style="margin-bottom:0; padding-bottom:0">Comparison Boundary:</h3>
<span class="comp-source-title" style="font-style:italic; color:gray; margin-left:15px;">None</span>
</td>
</tr>
</thead>
<tbody style="font-size:1.0em;line-height:1em;">
<tr>
<td class="stats-label">
<img src="images/google-docs.png" title="Source"/>
Source: (<span class="tooltip" data-text="Shown in order of most recent source first (e.g. starting with the dataset curator or publisher, ending with the original data source).">?</span>)
</td>
<td><div id="stats-main-source" class="stats-value"></div></td>
<td><div id="stats-comp-source" class="stats-value"></div></td>
</tr>
<tr>
<td class="stats-label">
<img src="images/hand-shake.png" title="License"/>
License:
</td>
<td><div id="stats-main-license" class="stats-value"></div></td>
<td><div id="stats-comp-license" class="stats-value"></div></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:2px" src="images/hierarchy-structure.png" title="Boundary Represented"/>
Level:
</td>
<td id="stats-main-level" class="stats-value"></td>
<td id="stats-comp-level" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img src="images/history.png" title="Icon created by Google from www.flaticons.com"/>
Year the Boundary Represents:
</td>
<td id="stats-main-year" class="stats-value"></td>
<td id="stats-comp-year" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:2px" src="images/calendar.png" title="Icon created by Freepik from www.flaticons.com"/>
Last Update:
</td>
<td id="stats-main-updated" class="stats-value"></td>
<td id="stats-comp-updated" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img src="images/count.png" title="Icon created by Sicon from www.flaticon.com"/>
Administrative Units:
</td>
<td id="stats-main-admincount" class="stats-value"></td>
<td id="stats-comp-admincount" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:3px" src="images/square.png" title="Icon created by Freepik from www.flaticons.com">
Area:
</td>
<td id="stats-main-area" class="stats-value"></td>
<td id="stats-comp-area" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:3px" src="images/selection-square.png" title="Icon created by Freepik from www.flaticons.com">
Perimeter (<span class="tooltip" data-text="The total length of borders across all boundary units.">?</span>):
</td>
<td id="stats-main-circumf" class="stats-value"></td>
<td id="stats-comp-circumf" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:5px" src="images/stats.png" title="Icon created by Freepik from www.flaticons.com"/>
Vertices (<span class="tooltip" data-text="The total number of line vertices across all boundary units.">?</span>):
</td>
<td id="stats-main-vertices" class="stats-value"></td>
<td id="stats-comp-vertices" class="stats-value"></td>
</tr>
<tr>
<td class="stats-label">
<img style="padding:5px" src="images/shape.png" title="Icon created by Pixelmeetup from www.flaticons.com"/>
Line Resolution (<span class="tooltip" data-text="The average resolution or distance between line vertices. Calculated as the total perimeter of all boundary units divided by the total number of vertices.">?</span>):
</td>
<td id="stats-main-avglineres" class="stats-value"></td>
<td id="stats-comp-avglineres" class="stats-value"></td>
</tr>
<tr style="display:none">
<!--Not shown-->
<td class="stats-label">
<img style="padding:5px" src="images/stats.png" title="Icon created by Freepik from www.flaticons.com"/>
Vertex Density (<span class="tooltip" data-text="The average number of vertices for every km of line distance. Calculated as the total number of vertices of all boundary units divided by the total perimeter.">?</span>):
</td>
<td id="stats-main-avglinedens" class="stats-value"></td>
<td id="stats-comp-avglinedens" class="stats-value"></td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<!--
<div hidden id="source-contents-banner" class="section-banner">
<img src="images/overlap.png" title="Overlap between sources">
<h2>Boundary Agreement</h2>
</div>
-->
<div hidden id="source-contents" class="row box" style="width:100%; margin:0px 0px">
<div hidden id="source-overlap-total" style="width:95%; text-align:center">
<h3>Matched Boundary Units (<span class="tooltip" data-text="Each boundary unit is matched to the boundary unit in the other source with the highest shared area overlap. The share of total overlapping area of matching units is then used to calculate the total source match. E.g., a 66% match means that only two-thirds of the area covered by both sources are considered matching/overlapping.">?</span>):</h3>
<div id="total-similarity" class="stats-percent" style="height:20px; width:80%"><span style="--data-width:0%"></span><p>Initiating...</p></div>
<br><br><br>
</div>
<br>
<div hidden id="match-table-div" style="width:95%">
<table id="match-table" class="table" style="margin-left:10px; page-break-after:auto">
<thead>
<th style="width:50%">
<hr style="border-color:#319FD3; background-color:#319FD3; margin:3px; height:3px">
<h3 style="margin-bottom:0; padding-bottom:0">Main Boundary:</h3>
<span class="main-source-title" style="font-style:italic; color:gray; margin-left:15px;">None</span>
<select id="main-names-table-select" style="color:black; font-size:smaller" onchange="mainFieldsDropdownChanged()">
<option selected>(Select name field)</option>
</select>
</th>
<th style="width:50%">
<hr style="border-color:rgb(255,0,0); background-color:rgb(255,0,0); margin:3px; height:3px">
<h3 style="margin-bottom:0; padding-bottom:0">Closest Comparison Match:</h3>
<span class="comp-source-title" style="font-style:italic; color:gray; margin-left:15px;">None</span>
<select id="comparison-names-table-select" style="color:black; font-size:smaller" onchange="comparisonFieldsDropdownChanged()">
<option selected>(Select name field)</option>
</select>
</th>
</thead>
<tbody>
</tbody>
</table>
</div>
<div id="nomatch-div" style="width:100%; margin:10px">
</div>
</div>
</article>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div data-include="_includes/footer.shtml"></div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/HTMLInclude.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="assets/js/papaparse.min.js"></script>
<!--this is for jszip-->
<script src="assets/js/jszip/jszip.js"></script>
<script src="assets/js/jszip/jszip-utils.js"></script>
<script type="text/javascript" src="assets/js/jszip/jszip-utils-ie.js"></script>
<!-- this is for shapefile-js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.3/proj4.js"></script>
<script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script>
<!--this is for dynamic boundary stats-->
<!--<script src="https://cdn.jsdelivr.net/npm/@turf/turf@5/turf.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Turf.js/6.5.0/turf.min.js" integrity="sha512-Q7HOppxoH0L2M7hreVoFCtUZimR2YaY0fBewIYzkCgmNtgOOZ5IgMNYxHgfps0qrO1ef5m7L1FeHrhXlq1I9HA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!--this is for printing pdf reports-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/print-js/1.6.0/print.js" integrity="sha512-/fgTphwXa3lqAhN+I8gG8AvuaTErm1YxpUjbdCvwfTMyv8UZnFyId7ft5736xQ6CyQN4Nzr21lBuWWA9RTCXCw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.1/html2canvas.min.js" integrity="sha512-Ki6BxhTDkeY2+bERO2RGKOGh6zvje2DxN3zPsNg4XhJGhkXiVXxIi1rkHUeZgZrf+5voBQJErceuCHtCCMuqTw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<script src="assets/js/html2canvas.js"></script> <!--this local file includes a patch for image object-fit from https://github.com/niklasvh/html2canvas/issues/2541-->
<script src="assets/js/ol.js"></script>
<script src="assets/js/ol-ext.min.js"></script>
<script src="assets/js/internalHelpers.js"></script>
<script src="assets/js/internalData.js"></script>
<script src="assets/js/internalSpatial.js"></script>
<script src="assets/js/geoContrast/Overview.js"></script>
<script src="assets/js/geoContrast/Stats.js"></script>
<script src="assets/js/geoContrast/BoundaryUnits.js"></script>
<script src="assets/js/geoContrast/FeatureCompare.js"></script>
<script src="assets/js/geoContrast/Toolbox.js"></script>
<script>
// bind file input actions
document.getElementById('main-file-input').addEventListener('change', handleMainFileUpload, false);
document.getElementById('comparison-file-input').addEventListener('change', handleComparisonFileUpload, false);
</script>
</body>
</html>