[mapserver-users] color range fade to transparent.

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Wed Jun 3 01:14:41 PDT 2015


Hi,

Never tried myself but for sure nodata value is not the way because it is not any continuous measure, it is just on/off. And opacity setting affects the whole layer as Jörg wrote.

I believe that the right way is to include alpha channel to the output colorrange. There are examples in the kernel density document http://mapserver.org/development/rfc/ms-rfc-108.html. In this example I suppose that the output color is total blue for the whole range from 0 to 32 but alpha value is growing from 0 to 255.

style
        COLORRANGE  "#0000ff00"  "#0000ffff"
        DATARANGE 0 32
end

I do not know how well and which clients support partial alpha values.

-Jukka Rahkonen-
 
Jörg Thomsen wrote:

Hi Bob,

this cannot work I think. A colorrange from 255 0 0 to 254 254 254 renders a map with many colors. In  best case only data values at 300 will be rendered 254 254 254 (perhaps you can check that with a color-picker? perhaps a clean 254 254 254 is never reached).

But I think you would like to have a layer where the smallest value is not transparent, the highest value is totally transparent and the values between are a bit transparent, right? I think you only can set the opacity for the whole layer.

Jörg

 Am 03.06.2015 um 00:33 schrieb Basques, Bob (CI-StPaul):
> All,
> 
> My solution below turned out to not be correct either.  It just ramps 
> down from RED to the color WHITE, no transparency.
> 
> Here is the layer block I'm using that I'm trying to fade to a 
> transparent feature:
> 
> MAP
> 
> TRANSPARENT true
> IMAGECOLOR 254 254 254
> 
> <more stuff>
> 
>         LAYER
>                 METADATA
>                  "ows_title" "bbox"
>                  "gml_include_items" "all"
>                 END
> GROUP 'users'
>                 NAME 'bbox'
>                 STATUS ON
>                 TYPE LINE
> 
> 
> <DB connections stuff>
> 
> 
> ## the following greabs a 5 min chunk of data (BBOX geoms  from the 
> database from 28 hrs ago and assigns a seq and elapsed time column to 
> the result.
>                 DATA "bbox from (
> 
>                         SELECT
> row_number() over (order by accessed_at nulls last) as seq, 
> date_part('epoch', (now() - INTERVAL '28 hours' -
> accessed_at)::interval) as elapsed,
> id, accessed_at, bbox
>                         FROM
>                                 layer_metrics
>                         Where
>                                 accessed_at < (NOW() - INTERVAL '28 
> hours') AND
>                                 accessed_at >= (NOW() - INTERVAL '28 
> hours' - INTERVAL '5 minute')
> 
>                                          ) as subquery using unique id 
> using srid=200068"
> 
>                 LABELITEM "elapsed"
> 
> CLASS
>                         #NAME "5 Minute Trail"
> EXPRESSION ([elapsed] >= 0 AND [elapsed] < 300) ## 0-5min STYLE
>                                 OUTLINECOLOR 0 0 0
>                                 OUTLINEWIDTH 1
>                                 #COLOR 0 255 0 COLORRANGE 255 0 0 254 
> 254 254 ##red to opaque (see IMAGECOLOR in the MAP block above) 
> DATARANGE 0 300 RANGEITEM "elapsed"
> 
> END
> END
> END
> END
> 
> 
> bobb
> 
> 
> 
>> On Jun 2, 2015, at 4:27 PM, Ben Madin <ben at ausvet.com.au 
>> <mailto:ben at ausvet.com.au>> wrote:
>>
>> Bob,
>>
>> Nice, I never knew that such a colorrange option existed (at least, I 
>> couldn't find it documented anywhere?) but I would have presumed 
>> maybe you could specify the colour using the alpha like any other colour?
>>
>>> COLORRANGE 255 0 0 255 255 255 255  0 ## red -> transparent
>>
>>
>>
>> Alternatively, if you had a common background colour, you could fade 
>> to that?
>>
>> cheers
>>
>> Ben
>>
>>
>>
>>> On 2015-06-03, at 04:48 , Basques, Bob (CI-StPaul) 
>>> <bob.basques at ci.stpaul.mn.us <mailto:bob.basques at ci.stpaul.mn.us>> wrote:
>>>
>>> All,
>>>
>>> Anyone know how to use a transparent color on one end of the 
>>> coloring option?
>>>
>>> COLORRANGE 255 0 0 ??? ??? ??? ## red -> transparent
>>>
>>> It there a RGB color to use for Transparency to fade to?  I 
>>> basically want to fade a line based on age to nothing.
>>>
>>> Thanks
>>>
>>> bobb
>>>
>>>
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org 
>>> <mailto:mapserver-users at lists.osgeo.org>
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>> --
>>
>> Ben Madin
>>
>> t : +61 8 6102 5535
>> m : +61 448 887 220
>> e : ben at ausvet.com.au <mailto:ben at ausvet.com.au>
>>
>> AusVet Animal Health Services
>> Western Australia
>>
>> AusVet's website:  http://www.ausvet.com.au
>>
>> This transmission is for the intended addressee only and is 
>> confidential information. If you have received this transmission in 
>> error, please delete it and notify the sender. The contents of this 
>> email are the opinion of the writer only and are not endorsed by 
>> AusVet Animal Health Services unless expressly stated otherwise.
>> Although AusVet uses virus scanning software we do not accept 
>> liability for viruses or similar in any attachments. Thanks for reading.
>>
> 
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list