[mapserver-dev] Undocumented Mapfile COLOR options

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Jul 23 09:01:46 PDT 2020


Hi Lars,

Please file your (easter) findings in the "docs" repository as a ticket, 
and I'll add them to the documentation (and point to your Gist as it 
will help me document them).  thanks!  -jeff





-- 
Jeff McKenna
MapServer Consulting and Training Services
co-founder of FOSS4G
http://gatewaygeo.com/



On 2020-07-23 12:43 p.m., Lars Schylberg wrote:
> Hello All,
> 
> I wrote about this as my Mapserver Easteregg findings two years ago:
> 
> https://lists.osgeo.org/pipermail/mapserver-users/2018-March/080547.html
> 
> I also made some different examples in my GIST:
> 
> https://gist.github.com/LarsSchy/df91553f1fda02196ba7881a129b4c64
> 
> I am not really sure how useful this is.
> 
> Sometimes when I want to make color tranparent I throw in a -1 in the 
> red color column, just because I know I can.
> 
> Happy summer
> 
> Lars Schylberg
> 
> 
> Den 2020-07-22 kl. 23:45, skrev Seth G:
>> 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 
>>
>>


More information about the mapserver-dev mailing list