-
Notifications
You must be signed in to change notification settings - Fork 0
/
gee_data_viewer.js
571 lines (543 loc) · 47.3 KB
/
gee_data_viewer.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
var default_vector_style = {
color: 'FFFFFF',
width: 0.5,
fillColor: '00000000',
}
var aggregate_polygons = {
'(*clear*)': '',
'PH Province': ['projects/ecoshard-202922/assets/gdam_PH_1', 'NAME_1'],
'PH Municipality': ['projects/ecoshard-202922/assets/gdam_PH_2', 'NAME_2'],
'IDN Province': ['projects/ecoshard-202922/assets/gdam_IDN_1', 'NAME_1'],
'IDN Regency': ['projects/ecoshard-202922/assets/gdam_IDN_2', 'NAME_2'],
}
var datasets = {
'(*clear*)': '',
'10_IDN_conservation_inf_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_conservation_inf_dspop__service_overlap_count.tif',
'10_IDN_conservation_inf_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_conservation_inf_dspop_ssp245__service_overlap_count.tif',
'10_IDN_conservation_inf_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_conservation_inf_road__service_overlap_count.tif',
'10_IDN_conservation_inf_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_conservation_inf_road_ssp245__service_overlap_count.tif',
'10_IDN_restoration_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_restoration_dspop__service_overlap_count.tif',
'10_IDN_restoration_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_restoration_dspop_ssp245__service_overlap_count.tif',
'10_IDN_restoration_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_restoration_road__service_overlap_count.tif',
'10_IDN_restoration_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_IDN_restoration_road_ssp245__service_overlap_count.tif',
'10_PH_conservation_inf_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_conservation_inf_dspop__service_overlap_count.tif',
'10_PH_conservation_inf_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_conservation_inf_dspop_ssp245__service_overlap_count.tif',
'10_PH_conservation_inf_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_conservation_inf_road__service_overlap_count.tif',
'10_PH_conservation_inf_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_conservation_inf_road_ssp245__service_overlap_count.tif',
'10_PH_restoration_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_restoration_dspop__service_overlap_count.tif',
'10_PH_restoration_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_restoration_dspop_ssp245__service_overlap_count.tif',
'10_PH_restoration_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_restoration_road__service_overlap_count.tif',
'10_PH_restoration_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/10_PH_restoration_road_ssp245__service_overlap_count.tif',
'25_IDN_conservation_inf_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_conservation_inf_dspop__service_overlap_count.tif',
'25_IDN_conservation_inf_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_conservation_inf_dspop_ssp245__service_overlap_count.tif',
'25_IDN_conservation_inf_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_conservation_inf_road__service_overlap_count.tif',
'25_IDN_conservation_inf_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_conservation_inf_road_ssp245__service_overlap_count.tif',
'25_IDN_restoration_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_restoration_dspop__service_overlap_count.tif',
'25_IDN_restoration_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_restoration_dspop_ssp245__service_overlap_count.tif',
'25_IDN_restoration_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_restoration_road__service_overlap_count.tif',
'25_IDN_restoration_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_IDN_restoration_road_ssp245__service_overlap_count.tif',
'25_PH_conservation_inf_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_conservation_inf_dspop__service_overlap_count.tif',
'25_PH_conservation_inf_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_conservation_inf_dspop_ssp245__service_overlap_count.tif',
'25_PH_conservation_inf_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_conservation_inf_road__service_overlap_count.tif',
'25_PH_conservation_inf_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_conservation_inf_road_ssp245__service_overlap_count.tif',
'25_PH_restoration_dspop__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_restoration_dspop__service_overlap_count.tif',
'25_PH_restoration_dspop_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_restoration_dspop_ssp245__service_overlap_count.tif',
'25_PH_restoration_road__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_restoration_road__service_overlap_count.tif',
'25_PH_restoration_road_ssp245__service_overlap_count': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/25_PH_restoration_road_ssp245__service_overlap_count.tif',
'diff_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_IDN_conservation_inf.tif',
'diff_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'diff_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_IDN_restoration.tif',
'diff_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_IDN_restoration_ssp245.tif',
'diff_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_PH_conservation_inf.tif',
'diff_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_PH_conservation_inf_ssp245.tif',
'diff_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_PH_restoration.tif',
'diff_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_flood_mitigation_PH_restoration_ssp245.tif',
'diff_quickflow_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_IDN_conservation_inf.tif',
'diff_quickflow_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_IDN_conservation_inf_ssp245.tif',
'diff_quickflow_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_IDN_restoration.tif',
'diff_quickflow_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_IDN_restoration_ssp245.tif',
'diff_quickflow_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_PH_conservation_inf.tif',
'diff_quickflow_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_PH_conservation_inf_ssp245.tif',
'diff_quickflow_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_PH_restoration.tif',
'diff_quickflow_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_quickflow_PH_restoration_ssp245.tif',
'diff_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_IDN_conservation_inf.tif',
'diff_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_IDN_conservation_inf_ssp245.tif',
'diff_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_IDN_restoration.tif',
'diff_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_IDN_restoration_ssp245.tif',
'diff_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_PH_conservation_inf.tif',
'diff_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_PH_conservation_inf_ssp245.tif',
'diff_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_PH_restoration.tif',
'diff_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_recharge_PH_restoration_ssp245.tif',
'diff_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_IDN_conservation_inf.tif',
'diff_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_IDN_conservation_inf_ssp245.tif',
'diff_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_IDN_restoration.tif',
'diff_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_IDN_restoration_ssp245.tif',
'diff_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_PH_conservation_inf.tif',
'diff_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_PH_conservation_inf_ssp245.tif',
'diff_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_PH_restoration.tif',
'diff_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/diff_sediment_PH_restoration_ssp245.tif',
'flood_mitigation_IDN_baseline_historical_climate': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/flood_mitigation_IDN_baseline_historical_climate.tif',
'flood_mitigation_PH_baseline_historical_climate': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/flood_mitigation_PH_baseline_historical_climate.tif',
'service_dspop_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_IDN_conservation_inf.tif',
'service_dspop_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'service_dspop_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_IDN_restoration.tif',
'service_dspop_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_IDN_restoration_ssp245.tif',
'service_dspop_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_PH_conservation_inf.tif',
'service_dspop_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_PH_conservation_inf_ssp245.tif',
'service_dspop_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_PH_restoration.tif',
'service_dspop_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_flood_mitigation_PH_restoration_ssp245.tif',
'service_dspop_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_IDN_conservation_inf.tif',
'service_dspop_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_IDN_conservation_inf_ssp245.tif',
'service_dspop_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_IDN_restoration.tif',
'service_dspop_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_IDN_restoration_ssp245.tif',
'service_dspop_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_PH_conservation_inf.tif',
'service_dspop_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_PH_conservation_inf_ssp245.tif',
'service_dspop_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_PH_restoration.tif',
'service_dspop_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_recharge_PH_restoration_ssp245.tif',
'service_dspop_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_IDN_conservation_inf.tif',
'service_dspop_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_IDN_conservation_inf_ssp245.tif',
'service_dspop_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_IDN_restoration.tif',
'service_dspop_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_IDN_restoration_ssp245.tif',
'service_dspop_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_PH_conservation_inf.tif',
'service_dspop_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_PH_conservation_inf_ssp245.tif',
'service_dspop_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_PH_restoration.tif',
'service_dspop_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_dspop_sediment_PH_restoration_ssp245.tif',
'service_road_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_IDN_conservation_inf.tif',
'service_road_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'service_road_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_IDN_restoration.tif',
'service_road_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_IDN_restoration_ssp245.tif',
'service_road_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_PH_conservation_inf.tif',
'service_road_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_PH_conservation_inf_ssp245.tif',
'service_road_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_PH_restoration.tif',
'service_road_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_flood_mitigation_PH_restoration_ssp245.tif',
'service_road_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_IDN_conservation_inf.tif',
'service_road_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_IDN_conservation_inf_ssp245.tif',
'service_road_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_IDN_restoration.tif',
'service_road_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_IDN_restoration_ssp245.tif',
'service_road_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_PH_conservation_inf.tif',
'service_road_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_PH_conservation_inf_ssp245.tif',
'service_road_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_PH_restoration.tif',
'service_road_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_recharge_PH_restoration_ssp245.tif',
'service_road_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_IDN_conservation_inf.tif',
'service_road_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_IDN_conservation_inf_ssp245.tif',
'service_road_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_IDN_restoration.tif',
'service_road_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_IDN_restoration_ssp245.tif',
'service_road_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_PH_conservation_inf.tif',
'service_road_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_PH_conservation_inf_ssp245.tif',
'service_road_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_PH_restoration.tif',
'service_road_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/service_road_sediment_PH_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf.tif',
'top_10th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_IDN_restoration.tif',
'top_10th_percentile_service_dspop_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_PH_conservation_inf.tif',
'top_10th_percentile_service_dspop_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_PH_restoration.tif',
'top_10th_percentile_service_dspop_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_flood_mitigation_PH_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_IDN_conservation_inf.tif',
'top_10th_percentile_service_dspop_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_IDN_restoration.tif',
'top_10th_percentile_service_dspop_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_PH_conservation_inf.tif',
'top_10th_percentile_service_dspop_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_PH_restoration.tif',
'top_10th_percentile_service_dspop_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_recharge_PH_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_IDN_conservation_inf.tif',
'top_10th_percentile_service_dspop_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_IDN_restoration.tif',
'top_10th_percentile_service_dspop_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_dspop_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_PH_conservation_inf.tif',
'top_10th_percentile_service_dspop_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_dspop_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_PH_restoration.tif',
'top_10th_percentile_service_dspop_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_dspop_sediment_PH_restoration_ssp245.tif',
'top_10th_percentile_service_road_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_IDN_conservation_inf.tif',
'top_10th_percentile_service_road_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_IDN_restoration.tif',
'top_10th_percentile_service_road_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_road_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_PH_conservation_inf.tif',
'top_10th_percentile_service_road_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_PH_restoration.tif',
'top_10th_percentile_service_road_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_flood_mitigation_PH_restoration_ssp245.tif',
'top_10th_percentile_service_road_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_IDN_conservation_inf.tif',
'top_10th_percentile_service_road_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_IDN_restoration.tif',
'top_10th_percentile_service_road_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_road_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_PH_conservation_inf.tif',
'top_10th_percentile_service_road_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_PH_restoration.tif',
'top_10th_percentile_service_road_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_recharge_PH_restoration_ssp245.tif',
'top_10th_percentile_service_road_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_IDN_conservation_inf.tif',
'top_10th_percentile_service_road_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_IDN_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_IDN_restoration.tif',
'top_10th_percentile_service_road_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_IDN_restoration_ssp245.tif',
'top_10th_percentile_service_road_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_PH_conservation_inf.tif',
'top_10th_percentile_service_road_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_PH_conservation_inf_ssp245.tif',
'top_10th_percentile_service_road_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_PH_restoration.tif',
'top_10th_percentile_service_road_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_10th_percentile_service_road_sediment_PH_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf.tif',
'top_25th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_IDN_restoration.tif',
'top_25th_percentile_service_dspop_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_PH_conservation_inf.tif',
'top_25th_percentile_service_dspop_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_PH_restoration.tif',
'top_25th_percentile_service_dspop_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_flood_mitigation_PH_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_IDN_conservation_inf.tif',
'top_25th_percentile_service_dspop_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_IDN_restoration.tif',
'top_25th_percentile_service_dspop_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_PH_conservation_inf.tif',
'top_25th_percentile_service_dspop_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_PH_restoration.tif',
'top_25th_percentile_service_dspop_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_recharge_PH_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_IDN_conservation_inf.tif',
'top_25th_percentile_service_dspop_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_IDN_restoration.tif',
'top_25th_percentile_service_dspop_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_dspop_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_PH_conservation_inf.tif',
'top_25th_percentile_service_dspop_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_dspop_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_PH_restoration.tif',
'top_25th_percentile_service_dspop_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_dspop_sediment_PH_restoration_ssp245.tif',
'top_25th_percentile_service_road_flood_mitigation_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_IDN_conservation_inf.tif',
'top_25th_percentile_service_road_flood_mitigation_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_flood_mitigation_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_IDN_restoration.tif',
'top_25th_percentile_service_road_flood_mitigation_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_road_flood_mitigation_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_PH_conservation_inf.tif',
'top_25th_percentile_service_road_flood_mitigation_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_flood_mitigation_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_PH_restoration.tif',
'top_25th_percentile_service_road_flood_mitigation_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_flood_mitigation_PH_restoration_ssp245.tif',
'top_25th_percentile_service_road_recharge_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_IDN_conservation_inf.tif',
'top_25th_percentile_service_road_recharge_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_recharge_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_IDN_restoration.tif',
'top_25th_percentile_service_road_recharge_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_road_recharge_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_PH_conservation_inf.tif',
'top_25th_percentile_service_road_recharge_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_recharge_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_PH_restoration.tif',
'top_25th_percentile_service_road_recharge_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_recharge_PH_restoration_ssp245.tif',
'top_25th_percentile_service_road_sediment_IDN_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_IDN_conservation_inf.tif',
'top_25th_percentile_service_road_sediment_IDN_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_IDN_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_sediment_IDN_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_IDN_restoration.tif',
'top_25th_percentile_service_road_sediment_IDN_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_IDN_restoration_ssp245.tif',
'top_25th_percentile_service_road_sediment_PH_conservation_inf': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_PH_conservation_inf.tif',
'top_25th_percentile_service_road_sediment_PH_conservation_inf_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_PH_conservation_inf_ssp245.tif',
'top_25th_percentile_service_road_sediment_PH_restoration': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_PH_restoration.tif',
'top_25th_percentile_service_road_sediment_PH_restoration_ssp245': 'gs://ecoshard-root/wwf_sipa_final_viewer_cogs/top_25th_percentile_service_road_sediment_PH_restoration_ssp245.tif'
};
var legend_styles = {
'black_to_red': ['000000', '005aff', '43c8c8', 'fff700', 'ff0000'],
'blue_to_green': ['440154', '414287', '218e8d', '5ac864', 'fde725'],
'cividis': ['00204d', '414d6b', '7c7b78', 'b9ac70', 'ffea46'],
'viridis': ['440154', '355e8d', '20928c', '70cf57', 'fde725'],
'blues': ['f7fbff', 'c6dbef', '6baed6', '2171b5', '08306b'],
'reds': ['fff5f0', 'fcbba1', 'fb6a4a', 'cb181d', '67000d'],
'turbo': ['321543', '2eb4f2', 'affa37', 'f66c19', '7a0403'],
};
var default_legend_style = 'blue_to_green';
function changeColorScheme(key, active_context) {
active_context.visParams.palette = legend_styles[key];
active_context.build_legend_panel();
active_context.updateVisParams();
}
function updateRasterLayer(key, active_context) {
if (key !== null) {
if (active_context.last_layer !== null) {
active_context.map.remove(active_context.last_layer);
}
active_context.raster = ee.Image.loadGeoTIFF(datasets[key]);
if (active_context.aoi_polygon != null) {
active_context.raster = active_context.raster.clipToCollection(active_context.aoi_polygon);
}
active_context.last_layer = active_context.map.addLayer(
active_context.raster, active_context.visParams);
}
}
var linkedMap = ui.Map();
// Center on Philippines
Map.setCenter(122.695894, 4, 5);
var linker = ui.Map.Linker([ui.root.widgets().get(0), linkedMap]);
// Create a SplitPanel which holds the linked maps side-by-side.
var splitPanel = ui.SplitPanel({
firstPanel: linker.get(0),
secondPanel: linker.get(1),
orientation: 'horizontal',
wipe: true,
style: {stretch: 'both'}
});
ui.root.widgets().reset([splitPanel]);
var panel_list = [];
[[Map, 'left'], [linkedMap, 'right']].forEach(function(mapside, index) {
var active_context = {
'last_layer': null,
'last_aoi': null,
'raster': null,
'point_val': null,
'last_point_layer': null,
'map': mapside[0],
'legend_panel': null,
'visParams': null,
'raster_key': null,
'polygon_key': null,
'last_labels': null,
};
active_context.map.style().set('cursor', 'crosshair');
active_context.visParams = {
min: 0.0,
max: 100.0,
palette: legend_styles[default_legend_style],
};
var panel = ui.Panel({
layout: ui.Panel.Layout.flow('vertical'),
style: {
'position': "middle-"+mapside[1],
'backgroundColor': 'rgba(255, 255, 255, 0.4)'
}
});
var default_control_text = mapside[1]+' controls';
var controls_label = ui.Label({
value: default_control_text,
style: {
backgroundColor: 'rgba(0, 0, 0, 0)',
}
});
var select = ui.Select({
items: Object.keys(datasets),
onChange: function(raster_key, self) {
active_context.raster_key = raster_key;
self.setDisabled(true);
var original_value = self.getValue();
self.setPlaceholder('loading ...');
self.setValue(null, false);
if (active_context.last_layer !== null) {
active_context.map.remove(active_context.last_layer);
active_context.last_layer = null;
active_context.min_val.setDisabled(true);
active_context.max_val.setDisabled(true);
}
if (datasets[raster_key] == '') {
self.setValue(original_value, false);
self.setDisabled(false);
return
}
updateRasterLayer(raster_key, active_context);
var mean_reducer = ee.Reducer.percentile([10, 90], ['p10', 'p90']);
var meanDictionary = active_context.raster.reduceRegion({
reducer: mean_reducer,
geometry: active_context.map.getBounds(true),
bestEffort: true,
});
ee.data.computeValue(meanDictionary, function (val) {
if (val['B0_p10'] != val['B0_p90']) {
active_context.visParams = {
min: val['B0_p10'],
max: val['B0_p90'],
palette: active_context.visParams.palette,
};
} else {
active_context.visParams = {
min: 0,
max: val['B0_p90'],
palette: active_context.visParams.palette,
};
}
active_context.min_val.setValue(active_context.visParams.min, false);
active_context.max_val.setValue(active_context.visParams.max, false);
active_context.min_val.setDisabled(false);
active_context.max_val.setDisabled(false);
self.setValue(original_value, false);
self.setDisabled(false);
});
}
});
var polygon_aggregate = ui.Select({
items: Object.keys(aggregate_polygons),
onChange: function(polygon_key, self) {
self.setDisabled(true);
var original_value = self.getValue();
self.setPlaceholder('loading ...');
self.setValue(null, false);
if (active_context.last_aoi !== null) {
active_context.map.remove(active_context.last_aoi);
}
if (active_context.last_layer !== null) {
active_context.map.remove(active_context.last_layer);
}
if (aggregate_polygons[polygon_key] == '') {
// nothing selected
self.setDisabled(false);
return
}
active_context.aoi_polygon = ee.FeatureCollection(aggregate_polygons[polygon_key][0]);
updateRasterLayer(active_context.raster_key, active_context);
// Add the feature to the map with styling
active_context.last_aoi = active_context.map.addLayer(
active_context.aoi_polygon.style(default_vector_style));
// Do the feature name layers
// Function to add labels at the centroid of each feature
var feature_id_key = aggregate_polygons[polygon_key][1];
self.setValue(original_value, false);
self.setDisabled(false);
}
});
active_context.min_val = ui.Textbox(
0, 0, function (value) {
active_context.visParams.min = +(value);
updateVisParams();
});
active_context.min_val.setDisabled(true);
active_context.max_val = ui.Textbox(
100, 100, function (value) {
active_context.visParams.max = +(value);
updateVisParams();
});
active_context.max_val.setDisabled(true);
active_context.point_val = ui.Textbox('nothing clicked');
function updateVisParams() {
if (active_context.last_layer !== null) {
active_context.last_layer.setVisParams(active_context.visParams);
}
}
active_context.updateVisParams = updateVisParams;
select.setPlaceholder('Choose a dataset...');
var range_button = ui.Button(
'Detect Range', function (self) {
self.setDisabled(true);
var base_label = self.getLabel();
self.setLabel('Detecting...');
var mean_reducer = ee.Reducer.percentile([10, 90], ['p10', 'p90']);
var meanDictionary = active_context.raster.reduceRegion({
reducer: mean_reducer,
geometry: active_context.map.getBounds(true),
bestEffort: true,
});
ee.data.computeValue(meanDictionary, function (val) {
active_context.min_val.setValue(val['B0_p10'], false);
active_context.max_val.setValue(val['B0_p90'], true);
self.setLabel(base_label)
self.setDisabled(false);
});
});
panel.add(controls_label);
panel.add(select);
polygon_aggregate.setPlaceholder('Filter through Administrative Levels');
panel.add(polygon_aggregate);
panel.add(ui.Label({
value: 'min',
style:{'backgroundColor': 'rgba(0, 0, 0, 0)'}
}));
panel.add(active_context.min_val);
panel.add(ui.Label({
value: 'max',
style:{'backgroundColor': 'rgba(0, 0, 0, 0)'}
}));
panel.add(active_context.max_val);
panel.add(range_button);
panel.add(ui.Label({
value: 'picked point',
style: {'backgroundColor': 'rgba(0, 0, 0, 0)'}
}));
panel.add(active_context.point_val);
panel_list.push([panel, active_context.min_val, active_context.max_val, active_context]);
active_context.map.add(panel);
function build_legend_panel() {
var makeRow = function(color, name) {
var colorBox = ui.Label({
style: {
backgroundColor: '#' + color,
padding: '4px 25px 4px 25px',
margin: '0 0 0px 0',
position: 'bottom-center',
}
});
var description = ui.Label({
value: name,
style: {
margin: '0 0 0px 0px',
position: 'top-center',
fontSize: '10px',
padding: 0,
border: 0,
textAlign: 'center',
backgroundColor: 'rgba(0, 0, 0, 0)',
}
});
return ui.Panel({
widgets: [colorBox, description],
layout: ui.Panel.Layout.Flow('vertical'),
style: {
backgroundColor: 'rgba(0, 0, 0, 0)',
}
});
};
var names = ['Low', '', '', '', 'High'];
if (active_context.legend_panel !== null) {
active_context.legend_panel.clear();
} else {
active_context.legend_panel = ui.Panel({
layout: ui.Panel.Layout.Flow('horizontal'),
style: {
position: 'top-center',
padding: '0px',
backgroundColor: 'rgba(255, 255, 255, 0.4)'
}
});
active_context.legend_select = ui.Select({
items: Object.keys(legend_styles),
placeholder: default_legend_style,
onChange: function(key, self) {
changeColorScheme(key, active_context);
}});
active_context.map.add(active_context.legend_panel);
}
active_context.legend_panel.add(active_context.legend_select);
// Add color and and names
for (var i = 0; i<5; i++) {
var row = makeRow(active_context.visParams.palette[i], names[i]);
active_context.legend_panel.add(row);
}
}
active_context.map.setControlVisibility(false);
active_context.map.setControlVisibility({"mapTypeControl": true});
build_legend_panel();
active_context.build_legend_panel = build_legend_panel;
});
var clone_to_right = ui.Button(
'Use this range in both windows', function () {
panel_list[1][1].setValue(panel_list[0][1].getValue(), false)
panel_list[1][2].setValue(panel_list[0][2].getValue(), true)
});
var clone_to_left = ui.Button(
'Use this range in both windows', function () {
panel_list[0][1].setValue(panel_list[1][1].getValue(), false)
panel_list[0][2].setValue(panel_list[1][2].getValue(), true)
});
//panel_list.push([panel, min_val, max_val, map, active_context]);
panel_list.forEach(function (panel_array) {
var map = panel_array[3].map;
map.onClick(function (obj) {
var point = ee.Geometry.Point([obj.lon, obj.lat]);
[panel_list[0][3], panel_list[1][3]].forEach(function (active_context) {
if (active_context.last_layer !== null) {
active_context.point_val.setValue('sampling...')
var point_sample = active_context.raster.sampleRegions({
collection: point,
//scale: 10,
//geometries: true
});
ee.data.computeValue(point_sample, function (val) {
if (val.features.length > 0) {
active_context.point_val.setValue(val.features[0].properties.B0.toString());
if (active_context.last_point_layer !== null) {
active_context.map.remove(active_context.last_point_layer);
}
active_context.last_point_layer = active_context.map.addLayer(
point, {'color': '#FF00FF'});
} else {
active_context.point_val.setValue('nodata');
}
});
}
});
});
});
panel_list[0][0].add(clone_to_right);
panel_list[1][0].add(clone_to_left);