Transparent GeoTIFF with true color

Hi,

I’m using Sentinel API to generate GeoTIFF in true color and NDVI from a polygon. With the NDVI, the outside of the polygon is transparent, but when I try with the true color, it’s always black.

Could you help me figure out what I’m doing wrong?

NDVI
//VERSION=3
function setup() {
    return {
        input: ["B04", "B08"],
        output: {
        bands: 1,
        sampleType: "FLOAT32"
        },
    };
}

function evaluatePixel(sample) {
    return [(sample.B08 - sample.B04) / (sample.B08 + sample.B04)];
}
True color
//VERSION=3
function setup() {
    return {
        input: ["B02", "B03", "B04", "SCL"],
        output: { bands: 3 }
    };
}

function evaluatePixel(sample) {
    return [2.5*sample.B04,  2.5*sample.B03,  2.5*sample.B02];
}

Thank you

Hi @manm,
can you let us know, which account you are using, so that we can check what happened on the back-end?

It’s cap@effigis.com

Hi @gmilcinski,
Any news on this subject?
Thank you :slight_smile:

Hi @manm,
we are still looking into it.
My first guess is that the API is behaving differently if the output is 0 (e.g. as it is probably the case of true color) or NaN (as it is probably with NDVI as you divide with 0).

We are at this moment working on update of the API to be able to control “no data” pixels, which should almost certainly solve your problem. That might take a (low) few weeks more though so I will come back to you if we find a workaround or a specific solution for your problem.

I’ll do it manually in QGIS until the update. Let me know if you find a solution. Thank you :slight_smile:

Hi @manm,

we have added an option to handle no data pixels within evalscript. See the documentation here: https://docs.sentinel-hub.com/api/latest/#/API/data_access?id=datamask-handling-for-pixels-with-no-data

We’ll give it a try this week.
Thank you so much!
Have a good day