<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div style="" class="">Do,</div><div style="" class=""><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">If you want to do this without using mapscript, you can pull the gradient calculation as an attribute from your data table.<br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""></div>ALTER TABLE mytable ADD COLUMN gradient_color VARCHAR;<div class="" style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
 HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">UPTATE mytable SET gradient_color = floor(gradient * 255)::text || ' 0 0';</div><div class="" style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Cheers<br style="" class=""></span></div><div style="" class=""> </div><font class="" style="font-weight:bold;color:rgb(0, 96, 191);font-family:verdana, helvetica, sans-serif;" size="2">Mtro. Carlos Ruiz</font><div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div
 class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="" class="" dir="ltr"> <font style="" class="" face="Arial" size="2"> On Monday, June 23, 2014 4:59 PM, "Lime, Steve D (MNIT)" <Steve.Lime@state.mn.us> wrote:<br style="" class=""> </font> </div>  <br style="" class=""><br style="" class=""> <div style="" class=""><div style="" class="" id="yiv6744052346"><style style="" class="">#yiv6744052346 #yiv6744052346 --
 
 _filtered #yiv6744052346 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
 _filtered #yiv6744052346 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv6744052346  
#yiv6744052346 p.yiv6744052346MsoNormal, #yiv6744052346 li.yiv6744052346MsoNormal, #yiv6744052346 div.yiv6744052346MsoNormal
        {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv6744052346 a:link, #yiv6744052346 span.yiv6744052346MsoHyperlink
        {color:blue;text-decoration:underline;}
#yiv6744052346 a:visited, #yiv6744052346 span.yiv6744052346MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
#yiv6744052346 span.yiv6744052346EmailStyle17
        {color:#1F497D;}
#yiv6744052346 .yiv6744052346MsoChpDefault
        {}
 _filtered #yiv6744052346 {margin:1.0in 1.0in 1.0in 1.0in;}
#yiv6744052346 div.yiv6744052346WordSection1
        {}
#yiv6744052346 </style><div style="" class="">
<div style="" class="">
<div style="" class=""><span class="" style="font-size:11.0pt;">You can compute a color string using PostgreSQL string functions:</span></div> 
<div style="" class=""><span class="" style="font-size:11.0pt;">  </span></div> 
<div style="" class=""><span class="" style="font-size:11.0pt;">  SELECT percentage || ‘ 0 0’ AS color FROM …</span></div> 
<div style="" class=""><span class="" style="font-size:11.0pt;">  </span></div> 
<div style="" class=""><span class="" style="font-size:11.0pt;">Steve</span></div> 
<div style="" class=""><span class="" style="font-size:11.0pt;">  </span></div> 
<div style="" class="" id="yiv6744052346yqt29921"><div style="" class=""><b style="" class=""><span class="" style="font-size:10.0pt;">From:</span></b><span class="" style="font-size:10.0pt;"> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org]
<b style="" class="">On Behalf Of </b>Do Wi<br style="" class="" clear="none">
<b style="" class="">Sent:</b> Sunday, June 22, 2014 3:50 PM<br style="" class="" clear="none">
<b style="" class="">To:</b> mapserver-users@lists.osgeo.org<br style="" class="" clear="none">
<b style="" class="">Subject:</b> [mapserver-users] color attribute question</span></div> 
<div style="" class="">  </div> 
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">hi!</span></div> 
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">i have this scenario:</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">i have a column in my postgis table which contains a double representing a percentage.</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">i want to color my polygons in a gradient fashion based on that number.</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">the docs states three ways to specify color:</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">1. three [1-255] numbers</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">2. hex string</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">3. [attribute]</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">but the attribute must be a string by itself in the same format as options 1 or 2.</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">how can i achieve something like </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">COLOR [percentage]*255 0 0</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">or</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">COLOR [percentage] 0 0</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">if percentageis already 0..255</span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">for a red gradient for example? </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">  </span></div> 
</div>
<div style="" class="">
<div style="" class=""><span class="" style="font-size:9.5pt;">thanks allot!</span></div> 
</div>
</div></div>
</div>
</div></div><br style="" class=""><div style="" class="" id="yqt11908">_______________________________________________<br style="" class="" clear="none">mapserver-users mailing list<br style="" class="" clear="none"><a style="" class="" shape="rect" ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br style="" class="" clear="none"><a style="" class="" shape="rect" href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a></div><br style="" class=""><br style="" class=""></div>  </div> </div>  </div> </div></body></html>