2024/6/25 Rephrasing the original question
I have published some single-band rasters as an ImageMosaic and exposed them through a WMS (Web Map Service). When I load this WMS service using OpenLayers (incorporating a CQL filter to limit the layer to a single raster dataset), areas outside the valid extent of the raster are rendered in the color representing the '0' value in the symbology. See the illustration below for reference:
The purple area represents the background color of the OpenLayers container which I have configured.
The green areas represent regions where no data exists; clicking on these areas yields a pixel value of 0.
The blue rectangular area denotes the data region. As you can observe, the no data areas appear transparent, while areas with data are rendered normally.
In my understanding, areas other than the valid data range should be rendered as transparent, not colored green.
The attributes of my original data are as follows:it is an 8-bit unsigned format, with a NoData value designated as 255.
Raster SLD as follows:
<sld:ColorMap type="intervals">
<sld:ColorMapEntry quantity="20" color="#38a800" label="极湿润(0 - 0.2)"/>
<sld:ColorMapEntry quantity="40" color="#8bd100" label="湿润(0.2 - 0.4)"/>
<sld:ColorMapEntry quantity="60" color="#ffff00" label="正常(0.4 - 0.6)"/>
<sld:ColorMapEntry quantity="80" color="#ff8000" label="干旱(0.6 - 0.8)"/>
<sld:ColorMapEntry quantity="101" color="#ff0000" label="极干旱(0.8 - 1)"/>
<sld:ColorMapEntry quantity="255" color="#828282" label="云"/>
</sld:ColorMap>
2024/6/25 Adding further clarification
I have also observed the same issue present in the geoserver OpenLayers Preview.
When I click on the valueless areas within the blue rectangular boundary, a popup displays the value as 255, which is the NoData value for the raster data. Its representation as transparent is correct.
When I click within the blue rectangular area in the image below, a popup shows the value as 0, and its display as transparent is accurate in this context.
When zooming the map to cover the area within the blue rectangle shown above (where the map view does not encompass any valid data from the raster), clicks on the map yield a popup displaying a value of 0. The map incorrectly renders this area in green. Ideally, these areas without data should appear transparent and should not trigger a popup, as they hold no meaningful data.
NoData=0
in your image mosaic property file (mosaicName.properties) and reload the GeoServer configuration.