Skip to content

Instantly share code, notes, and snippets.

@maximlamare
Created January 26, 2022 15:08
Show Gist options
  • Save maximlamare/9695976fd86d7024ba7b693cba0b15ad to your computer and use it in GitHub Desktop.
Save maximlamare/9695976fd86d7024ba7b693cba0b15ad to your computer and use it in GitHub Desktop.
How to return NDVI as UINT 16 in an Evalscript
//VERSION=3
function setup() {
return {
input: ["B04", "B08"],
output: { bands: 1, sampleType: "UINT16" }
};
}
function evaluatePixel(sample) {
let ndvi = index(sample.B08, sample.B04);
return [10000 * ndvi + 10000];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment