UNDP-Data / geo-cogserver

GeoHub COG server
GNU General Public License v3.0
1 stars 1 forks source link

NODATA value is not masked after adding NODATA option of titiler #95

Open JinIgarashi opened 3 months ago

JinIgarashi commented 3 months ago

In RasterTransform feature, I added nodata=-9999 to titiler endpoints, but this value is not becoming transparent (masked).

The below URL is titiler's /statistics/ endpoint.

https://titiler-dev.undpgeohub.org/cog/statistics?url=https%3A%2F%2Fundpgeohub.blob.core.windows.net%2Fuserdata%2Fa85516c81c0b78d3e89d3f00099b8b15%2Fdatasets%2FDem_Rwanda_10m_allt_20230921150153.tif%2FDem_Rwanda_10m_allt_20230921150153_band1.tif%3Fc3Y9MjAyMy0xMS0wMyZzcz1iJnNydD1vJnNlPTIwMjUtMDQtMjJUMDclM0E0OCUzQTIzWiZzcD1yJnNpZz1SMFYyb1VSZW5WZ0U4JTJGb2tSMnElMkZWSnVOVG9lWmpEVW9FM2VlcTclMkJ5WTNjJTNE&histogram_bins=10&expression=where%28b1+%3C+2112%2C+b1%2C+-9999%29%3B&nodata=-9999
statistics endpoint response ```json { "where(b1 < 2112, b1, -9999)":{ "min":-9999, "max":2111, "mean":-89.04128130744485, "count":974848, "sum":-86801715, "std":3201.58412936971, "median":1287, "majority":0, "minority":100, "unique":1226, "histogram":[ [ 87301, 0, 0, 0, 0, 0, 0, 0, 392128, 495419 ], [ -9999, -8788, -7577, -6366, -5155, -3944, -2733, -1522, -311, 900, 2111 ] ], "valid_percent":100, "masked_pixels":0, "valid_pixels":974848, "percentile_2":-9999, "percentile_98":2039 } } ```

As you can see, -9999 is set to min, and 0 pixel is masked from statistics api. Titiler doc says NODATA option will overwrite internal no data value, but the behaviour looks very weird (see the below screenshot from geohub).

image