[MapServer-users] mapserver: styling multiple stop colorrange for raster data

Trygve Aspenes trygve at aspenes.priv.no
Mon Aug 28 03:06:41 PDT 2023


Hi all

I'm looking into creating a styling for a raster of float32 data.
The data describes temperature in kelvin and I want to have a colorrange 
from blue to white for data up to 273 deg kelvin(0 deg C). And from 
white to red for warmer data.

I see here 
https://mapserver.org/output/kerneldensity.html#raster-color-ramping how 
this is used for heatmap hoping that this will work for a raster also.

I try with something like this:

     CLASS
       STYLE
         COLORRANGE "#0000ffff" "#ffffffff"
         DATARANGE 200 273
       END # STYLE
       STYLE
         COLORRANGE "#ffffffff" "#ff0000ff"
         DATARANGE 273 315
       END # STYLE
     END # CLASS

but as far as I can see this gives me only white.

If I try to use one style like this:

     CLASS
       STYLE
         COLORRANGE "#0000ffff" "#ff0000ff"
         DATARANGE 200 315
       END # STYLE
     END # CLASS

it works but the color range goes directly from red to blue.

Am I doing something wrong or can I not use multiple stops for these 
kind of data?

Trygve Aspenes



More information about the MapServer-users mailing list