File tree 5 files changed +140
-135
lines changed
5 files changed +140
-135
lines changed Original file line number Diff line number Diff line change
1
+ //VERSION=3
2
+ // To set custom max and min values, set
3
+ // choose your max and min values.
4
+ // The color map will then be scaled
5
+ // to those max and min values
6
+ const max = 8000 ;
7
+ const min = 0 ;
8
+
9
+ function setup ( ) {
10
+ return {
11
+ input : [ "DEM" , "dataMask" ] ,
12
+ output : [
13
+ { id : "default" , bands : 4 , sampleType : "AUTO" } ,
14
+ { id : "index" , bands : 1 , sampleType : "FLOAT32" } ,
15
+ { id : "dataMask" , bands : 1 } ,
16
+ ] ,
17
+ } ;
18
+ }
19
+ const map = [
20
+ [ 8000 , 0xffffff ] ,
21
+ [ 7000 , 0xf2f2f2 ] ,
22
+ [ 6000 , 0xe5e5e5 ] ,
23
+ [ 5500 , 0x493811 ] ,
24
+ [ 5000 , 0x5e4c26 ] ,
25
+ [ 4500 , 0x726038 ] ,
26
+ [ 4000 , 0x87724c ] ,
27
+ [ 3500 , 0x998760 ] ,
28
+ [ 3000 , 0xad9b75 ] ,
29
+ [ 2500 , 0xc1af89 ] ,
30
+ [ 2000 , 0xd6c49e ] ,
31
+ [ 1500 , 0xead8af ] ,
32
+ [ 1000 , 0xfcedbf ] ,
33
+ [ 900 , 0xaadda0 ] ,
34
+ [ 800 , 0xa5d69b ] ,
35
+ [ 700 , 0x96ce8e ] ,
36
+ [ 600 , 0x84c17a ] ,
37
+ [ 500 , 0x7aba70 ] ,
38
+ [ 400 , 0x72b266 ] ,
39
+ [ 300 , 0x5ea354 ] ,
40
+ [ 200 , 0x4c933f ] ,
41
+ [ 100 , 0x3d873d ] ,
42
+ [ 75 , 0x357c3a ] ,
43
+ [ 50 , 0x2d722d ] ,
44
+ [ 25 , 0x266821 ] ,
45
+ [ 10 , 0x1e5e14 ] ,
46
+ [ 0.00001 , 0x165407 ] ,
47
+ [ 0 , 0x0f0f8c ] ,
48
+ ] ;
49
+
50
+ const visualizer = new ColorRampVisualizer ( map , min , max ) ;
51
+
52
+ function evaluatePixel ( samples ) {
53
+ const imgVals = visualizer . process ( samples . DEM ) ;
54
+
55
+ // Return the 4 inputs and define content for each one
56
+ return {
57
+ default : [ ...imgVals , samples . dataMask ] ,
58
+ index : [ samples . DEM ] ,
59
+ dataMask : [ samples . dataMask ] ,
60
+ } ;
61
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
title : DEM Topographic Visualization
3
3
parent : DEM
4
4
layout : script
5
- permalink : /dem/dem-topographic/
6
5
nav_exclude : true
7
6
scripts :
8
- - - Visualization
9
- - script .js
10
- - - EO Browser
11
- - eob .js
7
+ - - Mapzen
8
+ - mapzen .js
9
+ - - COP-DEM
10
+ - cop-dem .js
12
11
examples :
13
12
- zoom : ' 10'
14
13
lat : ' 42.40876'
@@ -19,7 +18,7 @@ examples:
19
18
platform :
20
19
- CDSE
21
20
- EOB
22
- evalscripturl : https://custom-scripts.sentinel-hub.com/dem/dem-topographic/eob .js
21
+ evalscripturl : https://custom-scripts.sentinel-hub.com/dem/dem-topographic/mapzen .js
23
22
---
24
23
25
24
Original file line number Diff line number Diff line change
1
+ //VERSION=3
2
+ // To set custom max and min values, set
3
+ // defaultVis to false and choose your max and
4
+ // min values. The color map will then be scaled
5
+ // to those max and min values
6
+
7
+ const max = 8000 ;
8
+ const min = - 5000 ;
9
+ const seaLevel = 0 ;
10
+
11
+ function setup ( ) {
12
+ return {
13
+ input : [ "DEM" , "dataMask" ] ,
14
+ output : [
15
+ { id : "default" , bands : 4 , sampleTYPE : "AUTO" } ,
16
+ { id : "index" , bands : 1 , sampleType : "FLOAT32" } ,
17
+ { id : "dataMask" , bands : 1 } ,
18
+ ] ,
19
+ } ;
20
+ }
21
+
22
+ const landMap = [
23
+ [ 8000 , 0xffffff ] ,
24
+ [ 7000 , 0xf2f2f2 ] ,
25
+ [ 6000 , 0xe5e5e5 ] ,
26
+ [ 5500 , 0x493811 ] ,
27
+ [ 5000 , 0x5e4c26 ] ,
28
+ [ 4500 , 0x726038 ] ,
29
+ [ 4000 , 0x87724c ] ,
30
+ [ 3500 , 0x998760 ] ,
31
+ [ 3000 , 0xad9b75 ] ,
32
+ [ 2500 , 0xc1af89 ] ,
33
+ [ 2000 , 0xd6c49e ] ,
34
+ [ 1500 , 0xead8af ] ,
35
+ [ 1000 , 0xfcedbf ] ,
36
+ [ 900 , 0xaadda0 ] ,
37
+ [ 800 , 0xa5d69b ] ,
38
+ [ 700 , 0x96ce8e ] ,
39
+ [ 600 , 0x84c17a ] ,
40
+ [ 500 , 0x7aba70 ] ,
41
+ [ 400 , 0x72b266 ] ,
42
+ [ 300 , 0x5ea354 ] ,
43
+ [ 200 , 0x4c933f ] ,
44
+ [ 100 , 0x3d873d ] ,
45
+ [ 75 , 0x357c3a ] ,
46
+ [ 50 , 0x2d722d ] ,
47
+ [ 25 , 0x266821 ] ,
48
+ [ 10 , 0x1e5e14 ] ,
49
+ [ 0 , 0x165407 ] ,
50
+ ] ;
51
+
52
+ // add ocean color
53
+ const waterMap = [
54
+ [ - 5 , 0xa8d1ea ] ,
55
+ [ - 50 , 0x89a8d1 ] ,
56
+ [ - 100 , 0x687fba ] ,
57
+ [ - 500 , 0x4759a0 ] ,
58
+ [ - 1000 , 0x283087 ] ,
59
+ [ - 5000 , 0x070772 ] ,
60
+ ] ;
61
+ const landVis = new ColorRampVisualizer ( landMap , waterLevel , max ) ;
62
+ const waterVis = new ColorRampVisualizer ( waterMap , min , waterLevel ) ;
63
+
64
+ function evaluatePixel ( sample ) {
65
+ let val = sample . DEM ;
66
+ let imgVals = val > waterLevel ? landVis . process ( val ) : waterVis . process ( val ) ;
67
+
68
+ // Return the 4 inputs and define content for each one
69
+ return {
70
+ default : [ ...imgVals , sample . dataMask ] ,
71
+ index : [ val ] ,
72
+ dataMask : [ sample . dataMask ] ,
73
+ } ;
74
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments