[mapserver-dev] Undocumented Mapfile COLOR options

Seth G sethg at geographika.co.uk
Wed Jul 22 14:45:13 PDT 2020


Hi all,

Whilst validating various Mapfiles to try and find all valid options I've come across a couple of special values used in msautotest Mapfiles for COLOR - the first is -255 -255 -255 used in classtest1.map [1]

CLASS 
    NAME "Text"
    EXPRESSION ([pixel] == 0)
    COLOR -255 -255 -255
END

This value is defined in mapserver.h [2] as follows:

#define MS_TRANSPARENT_COLOR(color) (((color).alpha==0 || (color).red==-255 || (color).green==-255 || (color).blue==-255)?MS_TRUE:MS_FALSE)

So can this be set to make a color transparent? Is it a valid value and if so should this be added somewhere in the docs? There is currently no reference.

The second example is:

BACKGROUNDCOLOR -1 -1 -1 

LABEL BACKGROUNDCOLOR was removed in 6.0 [3] but is still present in mapserver\msautotest\misc\sde_utf2.map

One of the Python MapScript tests refers to this value as an "invalid color" that should throw an error [4]

Any details on these 2 COLOR values appreciated,

Seth


[1] https://github.com/mapserver/mapserver/blob/85e294e8c8ce3c9c455fea0137d4af1ee2feced0/msautotest/gdal/classtest1.map#L33
[2] https://github.com/mapserver/mapserver/blob/06a076e9d0992f3ace676933ddcde87985feea31/mapserver.h#L369
[3] https://mapserver.org/mapfile/label.html#mapfile-label-backgroundcolor
[4] https://github.com/mapserver/mapserver/blob/85e294e8c8ce3c9c455fea0137d4af1ee2feced0/mapscript/python/tests/cases/color_test.py#L50

--
web:http://geographika.co.uk
twitter: @geographika


More information about the mapserver-dev mailing list