-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex_copy.js
5285 lines (4726 loc) · 213 KB
/
index_copy.js
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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import 'ol/ol.css';
import 'ol-layerswitcher/dist/ol-layerswitcher.css';
import Map from 'ol/Map';
import View from 'ol/View';
import {GeoJSON} from 'ol/format';
import {Text, Style, Stroke, Fill} from 'ol/style';
import {Tile as TileLayer, Vector as VectorLayer, Group} from 'ol/layer';
import {fromLonLat} from 'ol/proj';
import OSM from 'ol/source/OSM';
import Overlay from 'ol/Overlay';
import {ScaleLine, ZoomToExtent, defaults as defaultControls, FullScreen} from 'ol/control';
import TopoJSON from 'ol/format/TopoJSON';
import Geocoder from 'ol-geocoder';
import LayerSwitcher from 'ol-layerswitcher';
import {Vector as VectorSource} from 'ol/source';
import XYZ from 'ol/source/XYZ';
import VectorImageLayer from 'ol/layer/VectorImage';
/**
* Elements that make up the popup.
*/
var container = document.getElementById('popup');
var content_element = document.getElementById('popup-content');
var info_element = document.getElementById('info-element');
var closer = document.getElementById('popup-closer');
/**
* Create an overlay to anchor the popup to the map.
*/
var overlay = new Overlay({
element: container,
autoPan: true,
autoPanAnimation: {
duration: 250,
},
});
/**
* Add a click handler to hide the popup.
* @return {boolean} Don't follow the href.
*/
closer.onclick = function () {
overlay.setPosition(undefined);
closer.blur();
return false;
};
// Designate Center of Map
const denmarkLonLat = [10.663375, 55.601306]; //10.835589, 56.232371
const denmarkWebMercator = fromLonLat(denmarkLonLat);
// 100km Grid Styling
var classification_search_100km = function (feature, resolution){
const fuzzyvalue = feature.get('fuzzyvalue')
var layercolor
if (fuzzyvalue < 0.05) {
layercolor='rgba(0, 0, 0, 0)'
}
else if (fuzzyvalue < 0.2) {
layercolor='rgba(217, 200, 0, 0.6)';
}
else if (fuzzyvalue < 0.6) {
layercolor='rgba(0, 200, 0, 0.6)';
}
else if (fuzzyvalue <= 1) {
layercolor='rgba(0, 100, 0, 0.6)';
}
else {layercolor='rgba(217, 200, 0, 0)';
}
return new Style({
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0)',
width: 0.1
}),
fill: new Fill({
color: layercolor
})
})
};
// 30km Grid Styling
var classification_search_30km = function (feature, resolution){
const fuzzyvalue = feature.get('fuzzyvalue')
var layercolor
if (fuzzyvalue < 0.05) {
layercolor='rgba(0, 0, 0, 0)'
}
else if (fuzzyvalue < 0.2) {
layercolor='rgba(217, 200, 0, 0.6)';
}
else if (fuzzyvalue < 0.6) {
layercolor='rgba(0, 200, 0, 0.6)';
}
else if (fuzzyvalue <= 1) {
layercolor='rgba(0, 100, 0, 0.6)';
}
else { layercolor='rgba(217, 200, 0, 0)';
}
return new Style({
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0)',
width: 0.1
}),
fill: new Fill({
color: layercolor
})
})
};
// 1km Grid Styling
var classification_search_1km = function (feature, resolution){
const fuzzyvalue = feature.get('fuzzyvalue')
var layercolor
if (fuzzyvalue < 0.05) {
layercolor='rgba(0, 0, 0, 0)'
}
else if (fuzzyvalue < 0.2) {
layercolor='rgba(217, 200, 0, 0.6)';
}
else if (fuzzyvalue < 0.6) {
layercolor='rgba(0, 200, 0, 0.6)';
}
else if (fuzzyvalue <= 1) {
layercolor='rgba(0, 100, 0, 0.6)';
}
else { layercolor='rgba(217, 200, 0, 0)';
}
return new Style({
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0)',
width: 0.1
}),
fill: new Fill({
color: layercolor
})
})
};
// Municipalities Boundary Style
var style = new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.6)'
}),
stroke: new Stroke({
color: '#319FD3',
width: 1
}),
text: new Text({
font: '12px Calibri,sans-serif',
fill: new Fill({
color: '#000'
}),
stroke: new Stroke({
color: '#fff',
width: 3
})
})
});
// DK Boundary Style
var dk_style = new Style({
fill: new Fill({
color: 'rgba(220, 241, 247, 0.6)'
}),
stroke: new Stroke({
color: '#319FD3',
width: 1
}),
text: new Text({
font: '12px Calibri,sans-serif',
fill: new Fill({
color: '#000'
}),
stroke: new Stroke({
color: '#fff',
width: 3
})
})
});
// Regions Boundary
var dk_boundary = new VectorLayer({
title: 'Regions',
visible: true,
source: new VectorSource({
format: new TopoJSON(),
url: "https://raw.githubusercontent.com/deldersveld/topojson/master/countries/denmark/denmark-counties.json",
}),
style: function(feature) {
dk_style.getText().setText(feature.get('NAME_1'));
return dk_style;
},
minResolution: 401,
});
// Pull Municipalities Boundaries from GitHub
var municipalities = new VectorLayer({
title: 'Municipalities',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: "https://raw.githubusercontent.com/Neogeografen/dagi/master/geojson/kommuner.geojson",
}),
style: function(feature) {
style.getText().setText(feature.get('KOMNAVN'));
return style;
},
minResolution: 15,
maxResolution: 400,
});
//Add OSM Schools layer (Purple)
var schools_geojson = require('./data/schools.geojson')
var schools = new VectorLayer({
title: 'Schools',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: schools_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(216, 193, 227, 0.6)',
}),
stroke: new Stroke({
color: '#ad31e8',
width: 1,
}),
}),
});
// Add Universities layer (Blue)
var universities_geojson = require('./data/universities.geojson')
var universities = new VectorLayer({
title: 'Universities',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: universities_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(121, 131, 242, 0.6)',
}),
stroke: new Stroke({
color: '#1420a3',
width: 1,
}),
}),
});
// Add Cinemas layer (Red)
var cinemas_geojson = require('./data/cinemas.geojson')
var cinemas = new VectorLayer({
title: 'Cinemas',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: cinemas_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(255, 0, 0, 0.5)',
}),
stroke: new Stroke({
color: '#ff0000',
width: 1,
}),
}),
});
// // Add Kindergartens layer (Aqua)
var kindergartens_geojson = require('./data/kindergartens.geojson')
var kindergartens = new VectorLayer({
title: 'Kindergartens',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: kindergartens_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(0, 255, 255, 0.5)',
}),
stroke: new Stroke({
color: '#00ffff',
width: 1,
}),
}),
});
// Public Transport Stations (Lime)
var pt_stations_geojson = require('./data/pt_stations.geojson')
var pt_stations = new VectorLayer({
title: 'Public Transport Stations',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: pt_stations_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(0, 255, 0, 0.5)',
}),
stroke: new Stroke({
color: '#bfff00',
width: 1,
}),
}),
});
// Theatres (Pink)
var theatres_geojson = require('./data/theatres.geojson')
var theatres = new VectorLayer({
title: 'Theatres',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: theatres_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(255, 193, 193, 0.5)',
}),
stroke: new Stroke({
color: '#ffclcl',
width: 1,
}),
}),
});
// Industries (Dark Green)
var industries_geojson = require('./data/industries.geojson')
var industries = new VectorLayer({
title: 'Industries',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: industries_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(0, 135, 68, 0.5)',
}),
stroke: new Stroke({
color: '#008744',
width: 1,
}),
}),
});
// Supermarkets (Light Blue)
var supermarkets_geojson = require('./data/supermarkets.geojson')
var supermarkets = new VectorLayer({
title: 'Supermarkets',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: supermarkets_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(51, 153, 255, 0.5)',
}),
stroke: new Stroke({
color: '#3399ff',
width: 1,
}),
}),
});
// Add OSM hospitals layer (Orange)
var hospitals_geojson = require('./data/hospitals.geojson')
var hospitals = new VectorLayer({
title: 'Hospitals',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: hospitals_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(255, 230, 161, 0.6)',
}),
stroke: new Stroke({
color: '#b58604',
width: 1,
}),
}),
});
/*
//Add Political Party Layer (THIS FILE IS TOO BIG- And need to be more creative with the style)
var politics_geojson = require('./data/crimes_politics.geojson')
var politics = new VectorLayer({
title: 'Political Party- 2017',
source: new VectorSource({
format: new GeoJSON(),
url: politics_geojson,
}),
style: function(feature) {
style.getText().setText(feature.get('political_'));
return style;
},
minResolution: 100,
});
*/
/*
// Add Water Bodies layer (Dark Blue)
var waterbodies_geojson = require('./data/waterbodies.geojson')
var waterbodies = new VectorLayer({
title: 'Water Bodies',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: waterbodies_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(0, 0, 204, 0.5)',
}),
stroke: new Stroke({
color: '#0000cc',
width: 1,
}),
}),
});
*/
// Roads (White)
var roads_geojson = require('./data/roads.geojson')
var roads = new VectorLayer({
title: 'Roads',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: roads_geojson,
}),
maxResolution: 1000,
style: new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.5)',
}),
stroke: new Stroke({
color: '#ffffff',
width: 3,
}),
}),
});
// Public Transport Stops (White)
var pt_stops_geojson = require('./data/pt_stops.geojson')
var pt_stops = new VectorLayer({
title: 'Public Transport Stops',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: pt_stops_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.5)',
}),
stroke: new Stroke({
color: '#ffffff',
width: 1,
}),
}),
});
// Add Restaurants layer (Yellow)
var restaurants_geojson = require('./data/restaurants.geojson')
var restaurants = new VectorLayer({
title: 'Restaurants',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: restaurants_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(255, 255, 0, 0.5)',
}),
stroke: new Stroke({
color: '#ffff00',
width: 1,
}),
}),
});
// Add OSM Leisure Parks layer (Green)
var leisureparks_geojson = require('./data/leisureparks.geojson')
var leisureparks = new VectorLayer({
title: 'Leisure Parks',
visible: false,
source: new VectorSource({
format: new GeoJSON(),
url: leisureparks_geojson,
}),
maxResolution: 100,
style: new Style({
fill: new Fill({
color: 'rgba(173, 237, 182, 0.6)',
}),
stroke: new Stroke({
color: '#08961b',
width: 1,
}),
}),
});
/*
WEIGHTED GRIDS
*/
// Add Weighted Grid (100km Resolution)
var grid100km_geojson = require('./data/grid100km_aq_p.geojson')
var grid100km = new VectorLayer({
title: 'Weighted Grid (100km)',
source: new VectorSource({
format: new GeoJSON(),
url: grid100km_geojson,
}),
minResolution: 400,
style: classification_search_100km
});
// Add Weighted Grid (30km Resolution)
var grid30km_geojson = require('./data/grid30km_aq_p.geojson')
var grid30km = new VectorLayer({
title: 'Weighted Grid (30km)',
source: new VectorSource({
format: new GeoJSON(),
url: grid30km_geojson,
}),
minResolution: 100,
maxResolution: 400,
style: classification_search_30km
});
// Hovestadden VectorImage
var grid1km_vectorimage_hovestad_geojson = require('./data/weighted_grid1km_hovestad.geojson')
var grid1km_vectorimage_hovestad = new VectorImageLayer({
title: 'Hovedstadden VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_hovestad_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
// Fyn VectorImage
var grid1km_vectorimage_fyn_geojson = require('./data/weighted_grid1km_Fyn.geojson')
var grid1km_vectorimage_fyn = new VectorImageLayer({
title: 'Fyn VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_fyn_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
// Midtjylland VectorImage
var grid1km_vectorimage_midtjylland_geojson = require('./data/weighted_grid1km_Midtjylland.geojson')
var grid1km_vectorimage_midtjylland = new VectorImageLayer({
title: 'Midtjylland VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_midtjylland_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
// Midtjylland West VectorImage
var grid1km_vectorimage_midtjyllandw_geojson = require('./data/weighted_grid1km_MidtjyllandW.geojson')
var grid1km_vectorimage_midtjyllandw = new VectorImageLayer({
title: 'Midtjylland West VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_midtjyllandw_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
/*
// Nordjylland VectorImage
var grid1km_vectorimage_nordjylland_geojson = require('./data/weighted_grid1km_Nordjylland.geojson')
var grid1km_vectorimage_nordjylland = new VectorImageLayer({
title: 'Nordjylland VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_nordjylland_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
*/
// Sjælland VectorImage
var grid1km_vectorimage_sjælland_geojson = require('./data/weighted_grid1km_Sjælland.geojson')
var grid1km_vectorimage_sjælland = new VectorImageLayer({
title: 'Sjælland VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_sjælland_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
/*
// Syddanmark VectorImage
var grid1km_vectorimage_syddanmark_geojson = require('./data/weighted_grid1km_Syddanmark.geojson')
var grid1km_vectorimage_syddanmark = new VectorImageLayer({
title: 'Syddanmark VectorImage',
imageRatio: 2,
source: new VectorSource({
url: grid1km_vectorimage_syddanmark_geojson,
format: new GeoJSON(),
}),
visible: true,
maxResolution: 100,
style: classification_search_1km,
});
*/
// Scaleline
var scaleline = new ScaleLine();
// Legend/Layer Visibilty
var layerSwitcher = new LayerSwitcher({
reverse: true,
groupSelectStyle: 'group'
});
var key = 'XtxbqBNbF5eQwYXV37Ym'; // ABP's Key
var attributions =
'<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a> ' +
'<a href="https://eng.sdfe.dk/" target="_blank">© SDFE</a> ';
// Define layers to be mapped
var layers = [
// Basemaps
new Group({
title: 'Basemap',
fold: 'open',
layers: [
new TileLayer({
title: 'OpenStreetMap',
source: new OSM(),
type: 'base'
}),
new TileLayer({
title: 'MapTiler',
source: new XYZ({
attributions: attributions,
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
maxZoom: 20,
crossOrigin: '',
}),
type: 'base'
}),
]
}),
// Data layers
new Group({
title: 'Map Layers',
layers: [
new Group({
title: 'Criteria Grids',
layers: [
grid100km,
grid30km,
grid1km_vectorimage_hovestad,
grid1km_vectorimage_fyn,
grid1km_vectorimage_midtjylland,
grid1km_vectorimage_midtjyllandw,
//grid1km_vectorimage_nordjylland,
grid1km_vectorimage_sjælland,
//grid1km_vectorimage_syddanmark
],
fold: 'close',
}),
new Group({
title: 'Data',
layers: [
universities,
municipalities,
hospitals,
schools,
leisureparks,
cinemas,
restaurants,
kindergartens,
pt_stops,
pt_stations,
roads,
theatres,
industries,
supermarkets,
//waterbodies,
//politics,
dk_boundary,
],
fold: 'close',
}),
]
})
];
// Instantiate Geocoder.
var geocoder = new Geocoder('nominatim', {
provider: 'osm',
lang: 'en',
placeholder: 'Enter Address (Denmark Only)...',
limit: 5,
keepOpen: false,
debug: true,
autoComplete: true,
countrycodes: 'dk'
});
// Display pin for geocoding result.
geocoder.getLayer().setVisible(true);
// Define map view.
var mapView = new View({
center: denmarkWebMercator,
zoom: 7
});
// Define map
var map = new Map({
controls: defaultControls().extend([scaleline, geocoder, layerSwitcher, new FullScreen(), new ZoomToExtent({
extent: [
644247.2179725806,
7066697.228365138,
1768177.2818778122,
8142930.58662042],
})]),
layers: layers,
view: mapView,
target: 'map'
});
/*
DEFINE & UPDATE SLIDERS
*/
// Universities Slider
var sliderUni = document.getElementById("uniDistance");
var outputUni = document.getElementById("outUni");
outputUni.innerHTML = sliderUni.value;
// Update slider value
sliderUni.oninput = function() {
outputUni.innerHTML = this.value;
};
// School Slider
var sliderSchools = document.getElementById("schoolDistance");
var outputSchools = document.getElementById("outSchool");
outputSchools.innerHTML = sliderSchools.value;
// Update slider value
sliderSchools.oninput = function() {
outputSchools.innerHTML = this.value;
};
// Parks Slider
var sliderParks = document.getElementById("parksDistance");
var outputParks = document.getElementById("outParks");
outputParks.innerHTML = sliderParks.value;
// Update slider value
sliderParks.oninput = function() {
outputParks.innerHTML = this.value;
};
// Roads Slider
var sliderRoads = document.getElementById("roadsDistance");
var outputRoads = document.getElementById("outRoads");
outputRoads.innerHTML = sliderRoads.value;
// Update slider value
sliderRoads.oninput = function() {
outputRoads.innerHTML = this.value;
};
// Coastlines Slider
var sliderCoasts = document.getElementById("coastDistance");
var outputCoasts = document.getElementById("outCoast");
outputCoasts.innerHTML = sliderCoasts.value;
// Update slider value
sliderCoasts.oninput = function() {
outputCoasts.innerHTML = this.value;
};
// Hospitals Slider
var sliderHospitals = document.getElementById("hospitalsDistance");
var outputHospitals = document.getElementById("outHospitals");
outputHospitals.innerHTML = sliderHospitals.value;
// Update slider value
sliderHospitals.oninput = function() {
outputHospitals.innerHTML = this.value;
};
// Supermarkets Slider
var sliderMarkets = document.getElementById("marketsDistance");
var outputMarkets = document.getElementById("outMarkets");
outputMarkets.innerHTML = sliderMarkets.value;
// Update slider value
sliderMarkets.oninput = function() {
outputMarkets.innerHTML = this.value;
};
// Water Bodies Slider
var sliderWater = document.getElementById("waterDistance");
var outputWater = document.getElementById("outWater");
outputWater.innerHTML = sliderWater.value;
// Update slider value
sliderWater.oninput = function() {
outputWater.innerHTML = this.value;
};
// Public Transport Stops Slider
var sliderPstops = document.getElementById("pstopsDistance");
var outputPstops = document.getElementById("outPstops");
outputPstops.innerHTML = sliderPstops.value;
// Update slider value
sliderPstops.oninput = function() {
outputPstops.innerHTML = this.value;
};
// Public Transport Stations Slider
var sliderPstations = document.getElementById("pstationsDistance");
var outputPstations = document.getElementById("outPstations");
outputPstations.innerHTML = sliderPstations.value;
// Update slider value
sliderPstations.oninput = function() {
outputPstations.innerHTML = this.value;
};
// Restuarants Slider
var sliderRestuarants = document.getElementById("restuarantsDistance");
var outputRestuarants = document.getElementById("outRestuarants");
outputRestuarants.innerHTML = sliderRestuarants.value;
// Update slider value
sliderRestuarants.oninput = function() {
outputRestuarants.innerHTML = this.value;
};
// Theatres Slider
var sliderTheatres = document.getElementById("theatreDistance");
var outputTheatres = document.getElementById("outTheatre");
outputTheatres.innerHTML = sliderTheatres.value;
// Update slider value
sliderTheatres.oninput = function() {
outputTheatres.innerHTML = this.value;
};
// Cinemas Slider
var sliderCinemas = document.getElementById("cinemasDistance");
var outputCinemas = document.getElementById("outCinemas");
outputCinemas.innerHTML = sliderCinemas.value;
// Update slider value
sliderCinemas.oninput = function() {
outputCinemas.innerHTML = this.value;
};
// Kindergarten Slider
var sliderKinder = document.getElementById("kinderDistance");
var outputKinder = document.getElementById("outKinder");
outputKinder.innerHTML = sliderKinder.value;
// Update slider value
sliderKinder.oninput = function() {
outputKinder.innerHTML = this.value;
};
// Industry Slider
var sliderIndustry = document.getElementById("industryDistance");
var outputIndustry = document.getElementById("outIndustry");
outputIndustry.innerHTML = sliderIndustry.value;
// Update slider value
sliderIndustry.oninput = function() {
outputIndustry.innerHTML = this.value;
};
// House Price Slider
var sliderHprice = document.getElementById("hpriceDistance");
var outputHprice = document.getElementById("outHprice");
outputHprice.innerHTML = sliderHprice.value;
// Update slider value
sliderHprice.oninput = function() {
outputHprice.innerHTML = this.value;
};
info_element.innerHTML = '<br><br><br><br>Search<br>&<br>Select a Cell';
/*
STLYE GRIDS BASED ON USER INPUT
*/
// Commit Search Button Feature
function commitSearchFunction() {
//Calculate Weights for 100km & 30km Grids
var source_100km = grid100km.getSource();
var features_100km = source_100km.getFeatures();
var source_30km = grid30km.getSource();
var features_30km = source_30km.getFeatures();
var source_1km_fyn = grid1km_vectorimage_fyn.getSource();
var features_1km_fyn = source_1km_fyn.getFeatures();
var source_1km_hovestad = grid1km_vectorimage_hovestad.getSource();
var features_1km_hovestad = source_1km_hovestad.getFeatures();
var source_1km_midtjylland = grid1km_vectorimage_midtjylland.getSource();
var features_1km_midtjylland = source_1km_midtjylland.getFeatures();
var source_1km_midtjyllandw = grid1km_vectorimage_midtjyllandw.getSource();
var features_1km_midtjyllandw = source_1km_midtjyllandw.getFeatures();
var source_1km_sjælland = grid1km_vectorimage_sjælland.getSource();
var features_1km_sjælland = source_1km_sjælland.getFeatures();
var uni_matchmax = 0;
var uni_matchmin = 0;
var uni_matchdiff = 0;
var cell_int_u = 0;
var uni_match_perc = 0;
var sch_matchmax = 0;
var sch_matchmin = 0;