WCS TRANSPARENT+GEOMETRY parameters stopped working?

We use WCS requests to download images using the GEOMETRY parameter to cut out invalid pixels from our AOIs and TRANSPARENT=true. By doing this, we get images with an Alpha channel with values 0 outside the GEOMETRY and 1 inside it.

Don’t know exactly when it began, but trying to request images today, we got black backgrounds outside the GEOMETRY and after analyzing the images, they had no Alpha channel, this occurred for every layer we tried (TRUE_COLOR, NDVI [GREYSCALE], NDVI, EVI, etc).

Nothing has changed in our layers configuration nor ir the requests we made, except for date, but even trying with old images we already downloaded and were ok this issue ocurred.

Ex: (request bellow image)

http://services.sentinel-hub.com/v1/wms/INSTANCE_ID?service=WMS&geometry=POLYGON+((-53.307853+-24.572338%2C+-53.305578+-24.574095%2C+-53.306522+-24.575422%2C+-53.307509+-24.578427%2C+-53.308368+-24.578856%2C+-53.312402+-24.577022%2C+-53.307853+-24.572338))&time=2020-04-16T00%3A00%3A00&request=GetMap&quality=100&priority=mostRecent&height=1000&TRANSPARENT=true&styles=GRAYSCALE&srs=epsg%3A4326&width=1046&showLogo=false&maxcc=20.0&version=1.1.1&format=image%2Fpng&crs=epsg%3A4326&layers=EVI

Can you provide first few blocks of the INSTANCE_ID, so that we can replicate the request in our environment?
There were some updates done on the “data mask” side, but I believe they should be backwards compatible. Still, do take a look in this examples if it helps somehow:
https://docs.sentinel-hub.com/api/latest/#/API/data_access?id=example-2-use-values-in-datamask-as-the-transparency-band

Hi @lucianoalberti,

we have identified the issue. It is indeed related to the data mask implementation as stated in the document I mentioned before.

The workaround is pretty simple - to adjust evalscript to handle transparency. I have now changed this on your account.

I apologise for inconvenience.

Best,
Grega

Hello @gmilcinski,

sorry but how we used one of the pre-configured layer schemas, we don’t really know much about the evalscripts, so thanks for changing it in my account! :grinning:

Best, Luciano

@gmilcinski sorry but I just realized that using any of the Base Products is keeping the black borders, in the case only EVI has been corrected, the only way to solve this is by editing the scritps for the rest of the layers I use with the data mask implementation?

If you let me know, which layers you are using (and which style), we can do this conversion for you.

Alternatively you can find the “simple version” version of the Custom script in our repository and do it yourself:

Since I don’t feel very comfortable on editing the the Scripts, I would really appreciate if you could do that

The Layers/Styles are:

  • TRUE_COLOR (default style)
  • NDVI (default style, greyscale)
  • MOISTURE_INDEX (default)
  • SAVI (greyscale)
  • LAI_SAVI (default)
  • EVI (greyscale)
  • CHL_RED_EDGE (dafault)

I believe we have configured all these layers.
Could you please double check if it works as expected?

As a side note - can you perhaps replace your API calls from
http://services.sentinel-hub.com/v1/wms
to
https://services.sentinel-hub.com/ogc/wms

The end-point you are using is deprecated for more than 3 years. It’s still working, as we are trying hard to remain backward compatible, but we would appreciate if you could update.
There should be no changes on your side.

Yes, they are all working, thanks for the help!

Sure, we will be updating it as soon as we can

Hi Grega

I’m also experiencing the same issue. I’m generating evalscripts on the fly to adjust the color ramp output - must the evalscript also be V3 compatible, or is there another way I can fix my evalscripts?

Regards
FC

Hi @fcbasson,
can you perhaps copy-paste an example of such call, so that we can take a look into details?
Do mask the second half of the instance ID.

I got the evalscript version 3 working dynamically without geometry clipping, but with the dataMask band I run into problems:

//VERSION=3 
function setup() {
    return {
        input: [{
            bands: ["B04", "B08", "dataMask"]
        }],
        output: {
            bands: 4
        }
    }
}

function evaluatePixel(samples) {
    let val = (samples.B08 - samples.B04) / (samples.B08 + samples.B04);
    var colorRamp1 = [
        [-0.15, [0.1, 0.3, 1]],
        [0, [0.576, 0.667, 0.835]],
        [0.035, [1, 1, 1]],
        [0.1, [0.843, 0.098, 0.11]],
        [0.2, [0.8, 0.25, 0.1]],
        [0.4, [1, 1, 0.686]],
        [0.6, [0.4, 0.8, 0.2]],
        [0.8, [0.1, 0.5, 0.1]],
        [1, [0, 0.4, 0.2]]
    ];
    let viz1 = new ColorRampVisualizer(colorRamp1);
    return [viz1.process(val), samples.dataMask];
}

And here is the call, which renders transparent tiles:
https://services.sentinel-hub.com/ogc/wmts/instance_ID?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=TRUE_COLOR,DATE,OUTLINE&STYLE=_null&FORMAT=undefined&TILEMATRIXSET=PopularWebMercator512&TILEMATRIX=14&TILEROW=4910&TILECOL=4525&time=2021-03-21&maxcc=50&cloudcorrection=replace&atmfilter=atmcor&priority=mostRecent&upsampling=BICUBIC&showlogo=false&format=image%2Fpng&evalscript=Ly9WRVJTSU9OPTMgCmZ1bmN0aW9uIHNldHVwKCkge3JldHVybiB7aW5wdXQ6IFt7YmFuZHM6IFsiQjA0IiwiQjA4IiwiZGF0YU1hc2siXX1dLG91dHB1dDoge2JhbmRzOiA0fX19IApmdW5jdGlvbiBldmFsdWF0ZVBpeGVsKHNhbXBsZXMpIHtsZXQgdmFsID0gKHNhbXBsZXMuQjA4IC0gc2FtcGxlcy5CMDQpIC8gKHNhbXBsZXMuQjA4ICsgc2FtcGxlcy5CMDQpOyB2YXIgY29sb3JSYW1wMSA9IFtbMC4xMyxbMC4xLDAuMywxXV0sWzAuMjEsWzAuNTc2LDAuNjY3LDAuODM1XV0sWzAuMjgsWzEsMSwxXV0sWzAuMzYsWzAuODQzLDAuMDk4LDAuMTFdXSxbMC40MyxbMC44LDAuMjUsMC4xXV0sWzAuNTEsWzEsMSwwLjY4NjI3NDUwOTgwMzkyMTZdXSxbMC41OCxbMC40LDAuOCwwLjJdXSxbMC42NixbMC4xLDAuNSwwLjFdXSxbMC43MyxbMCwwLjQsMC4yXV1dO2xldCB2aXoxID0gbmV3IENvbG9yUmFtcFZpc3VhbGl6ZXIoY29sb3JSYW1wMSk7cmV0dXJuIFt2aXoxLnByb2Nlc3ModmFsKSwgc2FtcGxlcy5kYXRhTWFza107fQ%3D%3D&geometry=POLYGON((2104851.87%20-3985579.62%2C2104631.28%20-3985799.37%2C2104525.21%20-3985689.99%2C2104461.15%20-3985748.05%2C2104344.44%20-3985631.80%2C2104464.27%20-3985475.12%2C2104472.08%20-3985465.18%2C2104473.83%20-3985466.28%2C2104596.98%20-3985600.35%2C2104730.79%20-3985463.90%2C2104851.87%20-3985579.62))

I managed to sort out the issue. My mistake was in the visualized output value returned - the visualiser value and the dataMask had to be joined in the same array. The geometry clipping is now working as expected.

//VERSION=3 
function setup() {
    return {
        input: [{
            bands: ["B04", "B08", "dataMask"]
        }],
        output: {
            bands: 4
        }
    }
}

function evaluatePixel(sample) {
    let val = (sample.B08 - sample.B04) / (sample.B08 + sample.B04);
    var colorRamp = [
        [-0.15, [0.1, 0.3, 1]],
        [0, [0.576, 0.667, 0.835]],
        [0.035, [1, 1, 1]],
        [0.1, [0.843, 0.098, 0.11]],
        [0.2, [0.8, 0.25, 0.1]],
        [0.4, [1, 1, 0.686]],
        [0.6, [0.4, 0.8, 0.2]],
        [0.8, [0.1, 0.5, 0.1]],
        [1, [0, 0.4, 0.2]]
    ];
    let viz = new ColorRampVisualizer(colorRamp);
    let vizval = viz.process(val);
    vizval.push(sample.dataMask);
    return vizval;
}

We like these kind of reports most :slight_smile:
Thanks for sharing the solution.