color range fade to transparent.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

color range fade to transparent.

blammo
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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

blammo
All answering my own question . . .

I think this is working:

Set TRANSPARENT and the IMAGECOLOR in the MAP block:

TRANSPARENT true
IMAGECOLOR 254 254 254

 . . . then, set the COLORRNGE accordingly:

COLORRANGE 255 0 0 254 254 254  ## Red to Transparent

bobb





> On Jun 2, 2015, at 3:48 PM, Basques, Bob (CI-StPaul) <[hidden email]> 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
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

Robert Sanson-2
In reply to this post by blammo
Hi Bob

You need an alpha (opacity) value that would go from 1 to 0.

Can you set an opacity value in your database as an attribute that is calculated from age? Then maybe you could set the OPACITY in your layer to read it from the database column?

Your output format should support RGBa values, so GIF or PNG.

Cheers,

Robert

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Basques, Bob (CI-StPaul)
Sent: Wednesday, 3 June 2015 8:48 a.m.
To: [hidden email]
Subject: [mapserver-users] color range fade to transparent.

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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

Ben Madin-2
In reply to this post by blammo
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) <[hidden email]> 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
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


--

Ben Madin

t : +61 8 6102 5535
m : +61 448 887 220
e : [hidden email]

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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

blammo
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 <[hidden email]> 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) <[hidden email]> 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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users


--

Ben Madin

t : +61 8 6102 5535
m : +61 448 887 220
e : [hidden email]

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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

Jörg Thomsen
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 <[hidden email]
>> <mailto:[hidden email]>> 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)
>>> <[hidden email] <mailto:[hidden email]>> 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
>>> [hidden email] <mailto:[hidden email]>
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>> --
>>
>> Ben Madin
>>
>> t : +61 8 6102 5535
>> m : +61 448 887 220
>> e : [hidden email] <mailto:[hidden email]>
>>
>> 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
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>

_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: color range fade to transparent.

jratike80
In reply to this post by blammo
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 <[hidden email]
>> <mailto:[hidden email]>> 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)
>>> <[hidden email] <mailto:[hidden email]>> 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
>>> [hidden email]
>>> <mailto:[hidden email]>
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>> --
>>
>> Ben Madin
>>
>> t : +61 8 6102 5535
>> m : +61 448 887 220
>> e : [hidden email] <mailto:[hidden email]>
>>
>> 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
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>

_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users