-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed usage of ColorGradientVisualizer (#327)
* Removed usage of ColorGradientVisualizer * Non-hardcoded examples for hls * Parametrized dem examples
- Loading branch information
1 parent
f7af3a8
commit 28452f7
Showing
48 changed files
with
862 additions
and
874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,49 @@ | ||
//VERSION=3 | ||
// To set custom max and min values, set | ||
// defaultVis to false and choose your max and | ||
// min values. The color map will then be scaled | ||
// choose your max and min values. | ||
// The color map will then be scaled | ||
// to those max and min values | ||
const defaultVis = true | ||
const max = 9000 | ||
const min = -9000 | ||
const max = 9000; | ||
const min = -12000; | ||
|
||
function setup() { | ||
return { | ||
input: ["DEM", "dataMask"], | ||
output: { bands: 4, sampleTYPE: "AUTO" }, | ||
}; | ||
} | ||
|
||
function updateMap(max, min) { | ||
const numIntervals = map.length | ||
const intervalLength = (max - min) / (numIntervals - 1); | ||
for (let i = 0; i < numIntervals; i++) { | ||
map[i][0] = max - intervalLength * i | ||
} | ||
return { | ||
input: ["DEM", "dataMask"], | ||
output: { bands: 4, sampleTYPE: "AUTO" }, | ||
}; | ||
} | ||
|
||
const map = [ | ||
[9000, 0xffffff], | ||
[7000, 0xf9f9f9], | ||
[5000, 0xf5f5f5], | ||
[3000, 0xebebeb], | ||
[1000, 0xe0e0e0], | ||
[500, 0xd6d6d6], | ||
[400, 0xc7c7c7], | ||
[300, 0xb4b4b4], | ||
[200, 0x9f9f9f], | ||
[50, 0x8b8b8b], | ||
[30, 0x828282], | ||
[10, 0x6d6d6d], | ||
[0, 0x636363], | ||
[-10, 0x5a5a5a], | ||
[-20, 0x545454], | ||
[-50, 0x505050], | ||
[-200, 0x4a4a4a], | ||
[-500, 0x464646], | ||
[-1000, 0x3d3d3d], | ||
[-5000, 0x373737], | ||
[-9000, 0x181818], | ||
[-12000, 0x000000], | ||
[9000, 0xffffff], | ||
[7000, 0xf9f9f9], | ||
[5000, 0xf5f5f5], | ||
[3000, 0xebebeb], | ||
[1000, 0xe0e0e0], | ||
[500, 0xd6d6d6], | ||
[400, 0xc7c7c7], | ||
[300, 0xb4b4b4], | ||
[200, 0x9f9f9f], | ||
[50, 0x8b8b8b], | ||
[30, 0x828282], | ||
[10, 0x6d6d6d], | ||
[0, 0x636363], | ||
[-10, 0x5a5a5a], | ||
[-20, 0x545454], | ||
[-50, 0x505050], | ||
[-200, 0x4a4a4a], | ||
[-500, 0x464646], | ||
[-1000, 0x3d3d3d], | ||
[-5000, 0x373737], | ||
[-9000, 0x181818], | ||
[-12000, 0x000000], | ||
]; | ||
|
||
if (!defaultVis) updateMap(max, min); | ||
const visualizer = new ColorRampVisualizer(map); | ||
const visualizer = new ColorRampVisualizer(map, min, max); | ||
|
||
function evaluatePixel(sample) { | ||
let val = sample.DEM; | ||
let imgVals = visualizer.process(val) | ||
let val = sample.DEM; | ||
let imgVals = visualizer.process(val); | ||
|
||
// Return the 4 inputs and define content for each one | ||
return [...imgVals, sample.dataMask] | ||
// Return the 4 inputs and define content for each one | ||
return [...imgVals, sample.dataMask]; | ||
} |
Oops, something went wrong.