[mapserver-users] color attribute question

Carlos Ruiz boolean10001 at yahoo.com
Mon Jun 23 08:13:29 PDT 2014


Do,

If you want to do this without using mapscript, you can pull the gradient calculation as an attribute from your data table.

ALTER TABLE mytable ADD COLUMN gradient_color VARCHAR;
UPTATE mytable SET gradient_color = floor(gradient * 255)::text || ' 0 0';

Cheers

 Mtro. Carlos Ruiz


On Monday, June 23, 2014 4:59 PM, "Lime, Steve D (MNIT)" <Steve.Lime at state.mn.us> wrote:
 


You can compute a color string using PostgreSQL string functions:
 
  SELECT percentage || ‘ 0 0’ AS color FROM …
 
Steve
 
From:mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Do Wi
Sent: Sunday, June 22, 2014 3:50 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] color attribute question
 
hi!
 
i have this scenario:
i have a column in my postgis table which contains a double representing a percentage.
 
i want to color my polygons in a gradient fashion based on that number.
 
the docs states three ways to specify color:
1. three [1-255] numbers
2. hex string
3. [attribute]
 
but the attribute must be a string by itself in the same format as options 1 or 2.
 
how can i achieve something like 
 
COLOR [percentage]*255 0 0
or
COLOR [percentage] 0 0
if percentageis already 0..255
 
for a red gradient for example? 
 
thanks allot!

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140623/99dfb724/attachment.htm>


More information about the MapServer-users mailing list