1

In MapServer, is there a way to use the PROCESSING "SCALE=AUTO" directive to get dynamic (current extent) contrast stretching with custom colorranges? When I test my mapfile (relevant layer part below) with the Openlayers viewer it gets the desired color ramps but does not do contrast stretching for the current extent. If I take the CLASS'es out the greyscale output is contrast stretched according to current extent. I have tried taking out the EXPRESSIONS and/or the DATARANGES but then it only takes the first COLORRANGE and does not stretch it.

# raster layer
LAYER  
    NAME "mapservtest"  
    TYPE RASTER  
    PROCESSING "SCALE=AUTO"  
    STATUS ON  
    DEBUG ON  
    PROJECTION  
        "init=epsg:3857"  
    END  
    METADATA  
        #WMS stuff here  
    END  
    TILEITEM "location" #location is a column in postgis table with varchar of the filepath to each image  
    TILEINDEX "index"  
    FILTER (`[datetime]` = `2015-01-01T00:00:00Z`)  
    OFFSITE 0 0 0  
    CLASS  
        EXPRESSION ([pixel] >= 25 AND [pixel] < 30)  
        STYLE  
            COLORRANGE  "#00ff00"  "#0000ff"  
            DATARANGE 25 30  
        END # STYLE  
    END # CLASS  
    CLASS  
        EXPRESSION ([pixel] < 25)  
        STYLE  
            COLORRANGE  "#ff0000"  "#00ff00"  
            DATARANGE 20 25  
        END # STYLE  
    END # CLASS  
END  
0

At the moment the answer is no, but it may be possible to use dynamic scaling and classification together soon. See the ticket https://github.com/mapserver/mapserver/issues/5830#issuecomment-516913638 for details.

Perhaps you can get more pressure to include this enhancement into version 7.6 by adding a comment and volunteering to test.

1
  • Thanks, I will have a look at that. – Theo Pauw Aug 29 '19 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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