How Can I Get Actual NDVI Values?

If you want to get float values out of the service, you will have to use 32-bit float image type (as uint8 and uint16 types only support integers). A custom script which will return NDVI values for Sentinel-2 data could be:


    function setup() {


        input: [{

          bands: ["B04", "B08"]


        output: {

          id: "default",

          bands: 1,

          sampleType: SampleType.FLOAT32




    function evaluatePixel(sample) {

      let ndvi = (sample.B08 - sample.B04) / (sample.B08 + sample.B04)

      return [ ndvi ]

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.