[MapServer-users] Custom grayscale style on single band float32 geotiff looks strange

Trygve Aspenes trygve at aspenes.priv.no
Mon Nov 28 05:56:22 PST 2022


Hi

So, I have a single band geotiff with float32 values. Opening it 
directly in eg. QGIS, this looks fine.
I define various styles with fixed colors for pixels with defined value 
range for this looking as expected, but then I define a kind of 
grayscale style looking like this in mapfile:

     CLASS
       NAME "orig"
       GROUP "GRAYSCALE"
       STYLE
         RANGEITEM "pixel"
         COLORRANGE 0 0 0  255 255 255
         DATARANGE -31.500000 96.000000
       END # STYLE
     END # CLASS

however the resulting image is partly grayscale and spottet with light 
blue pixels. Please see the attached image link how it looks: 
https://drive.google.com/file/d/1JfyCL047JngCJh44jpa7Ei7a5wqhihOM/view?usp=share_link
So I think I do something wrong defining the grayscale style like this.
I tried to ask for the SLD for to see what mapserver makes for me, but 
alas, no luck. If a do a GetStyles request I only get an empty SLD 
document:

curl 
'http://localhost:8000/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetStyles&LAYERS=layer-name'
<StyledLayerDescriptor version="1.1.0" 
xsi:schemaLocation="http://www.opengis.net/sld 
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" 
xmlns="http://www.opengis.net/sld" 
xmlns:ogc="http://www.opengis.net/ogc" 
xmlns:se="http://www.opengis.net/se" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</StyledLayerDescriptor>

So someone have an idea why my image looks spotty when expecting a 
grayscale image and why do I get an empty SLD?


More information about the MapServer-users mailing list