0

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: enter image description here

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. enter image description here

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.

enter image description here

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. enter image description here

6
  • That is expected, what else should areas with no data show. What is your question?
    – Ian Turton
    Commented Jun 24 at 10:32
  • Try adding NoData=0 in your image mosaic property file (mosaicName.properties) and reload the GeoServer configuration. Commented Jun 24 at 10:58
  • @IanTurton Apologies for the elaboration, but I've refined the description of the issue and included additional test results. Areas devoid of data, when rendered in green instead of being transparent, overlay and obstruct our base map, which is aesthetically unpleasing.
    – 苏云明
    Commented Jun 25 at 2:41
  • @AndreaAime I'm a bit confused. How do I reload the service configuration? Does this entail restarting GeoServer? Moreover, the NoData value for my dataset should be 255, not 0. Configuring it as 0 might inadvertently create voids within the valid data regions of my dataset.
    – 苏云明
    Commented Jun 25 at 2:46
  • @AndreaAime I have added more details to the issue. Could you please review the problem again.
    – 苏云明
    Commented Jun 25 at 2:47

1 Answer 1

0

Friends, I have resolved this issue. It requires modifying the 'Footprint Behavior' setting in the Layer Properties interface, under the 'Data' tab, to 'cut'. This option masks the layer extent based on the boundaries of the mosaic dataset, making areas outside these boundaries transparent. Consequently, the layer displays correctly on the map.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.