forked from sentinel-hub/custom-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
73 lines (70 loc) · 1.99 KB
/
script.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
//VERSION=3
// This scripts visualise land cover over Metropolitan France
// Set up input and output settings
function setup() {
return {
input: [{
bands: [
"OCS"
]
}],
output: {
bands: 4
}
}
}
//EvaluatePixel function - return corresponding color based on CNES Land Cover nomenclature and colouring scheme
function evaluatePixel(samples) {
const val = samples.OCS;
if (val == 1) {
return [1, 0, 1, 1];
} else if (val == 2) {
return [1, 85/255, 1, 1];
} else if (val == 3) {
return [1, 170/255, 1, 1];
} else if (val == 4) {
return [0, 1, 1, 1];
} else if (val == 5) {
return [1, 1, 0, 1];
} else if (val == 6) {
return [208/255, 1, 0, 1];
} else if (val == 7) {
return [161/255, 214/255, 0, 1];
} else if (val == 8) {
return [1, 171/255, 68/255, 1];
} else if (val == 9) {
return [214/255, 214/255, 0, 1];
} else if (val == 10) {
return [1, 85/255, 0, 1];
} else if (val == 11) {
return [197/255, 1, 1, 1];
} else if (val == 12) {
return [170/255, 170/255, 97/255, 1];
} else if (val == 13) {
return [170/255, 170/255, 0, 1, 1];
} else if (val == 14) {
return [170/255, 170/255, 1, 1];
} else if (val == 15) {
return [85/255, 0, 0, 1];
} else if (val == 16) {
return [0, 156/255, 0, 1];
} else if (val == 17) {
return [0, 50/255, 0, 1];
} else if (val == 18) {
return [170/255, 250/255, 0, 1];
} else if (val == 19) {
return [85/255, 170/255, 127/255, 1];
} else if (val == 20) {
return [1, 0, 0, 1];
} else if (val == 21) {
return [1, 184/255, 2/255, 1];
} else if (val == 22) {
return [190/255, 190/255, 190/255, 1];
} else if (val == 23) {
return [0, 0, 1, 1];
} else if (val == 0 || val == 255) {
return [1, 1, 1, 0];
} else {
return [0, 0, 0, 1];
}
}