<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        mso-believe-normal-left:yes;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><![if mso 9]><style>p.MsoNormal
        {margin-left:3.0pt;}
</style><![endif]><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="margin-left:3.0pt;margin-top:3.0pt;margin-right:3.0pt;margin-bottom:.75pt">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Robert,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">It may be that the SDE plugin does not allow insertion of the Sql fragment from the COLOR to be executed by the provider. In such a case the solution provided
 under separate cover by B. Heath Robinson might provide guidance. I do not know if the ArcGIS Server lets you use a view as a data source; if so you could add a calculated column to yield the RGB string (either as a hexadecimal valye as suggested by Heath)
 or as a string with space-delimited R, G and B values.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">FWIW the approach I had suggested worked in MapServer 5.6.2 against Sql Server 2008; beyond that I&#8217;ve not tried it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">- Phil<o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Robert Sanson [mailto:Robert.Sanson@asurequality.com]
<br>
<b>Sent:</b> Wednesday, July 06, 2011 4:48 PM<br>
<b>To:</b> Anzel, Phil - Fort Collins, CO; mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> RE: Random colours for polygon fill?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">Looks an interesting approach. I tried it with my layer in ArcGIS Server (stored in MS-SQL v 2005) and couldn't get it to work. I am using Mapserver 5.4.2<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">Here is my layer:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">LAYER<br>
&nbsp; NAME fbnd<br>
&nbsp; GROUP &quot;CRS&quot;<br>
&nbsp; TYPE POLYGON<br>
&nbsp; STATUS ON<br>
&nbsp; CONNECTIONTYPE SDE<br>
&nbsp; CONNECTIONTYPE PLUGIN<br>
&nbsp; PLUGIN &quot;d:/ms4w/apache/specialplugins/msplugin_sde_93.dll&quot;<br>
&nbsp; CONNECTION &quot;db-esri,port:5155,cadastre,user,pass&quot;<br>
&nbsp; DATA &quot;CADASTRE.SDEADMIN.VW_FARM_BOUNDARY_SP,SHAPE&quot;<br>
&nbsp; DUMP TRUE<br>
&nbsp; HEADER&nbsp;&nbsp; ../templates/apiaries_query_header.html<br>
&nbsp; TEMPLATE ../templates/apiaries_query_body.html<br>
&nbsp; LABELMAXSCALE 100000<br>
&nbsp; LABELCACHE on<br>
&nbsp; LABELITEM 'key_decision_maker'<br>
&nbsp; MAXSCALE 250000<br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; NAME &quot;fbnd&quot;<br>
&nbsp;&nbsp;&nbsp; DEBUG on<br>
&nbsp;&nbsp;&nbsp; STYLE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIDTH 3<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #COLOR 135 206 235<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR [convert(varchar(3), ((128 &#43; convert(int,env_min_x)) % 253)) &#43; &quot; &quot; &#43; convert(varchar(3), ((200 &#43; convert(int,env_min_x)) % 254)) &#43; &quot; &quot; &#43; convert(varchar(3), ((64 &#43; convert(int,env_min_x)) % 255))]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 0 255 0<br>
&nbsp;&nbsp;&nbsp; END<br>
&nbsp;&nbsp;&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE truetype<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT &quot;arial&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE 9<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION auto<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 255 255 255 #--Halo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 76 179 145 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MINDISTANCE 50<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BUFFER 2<br>
&nbsp;&nbsp;&nbsp; END #LABEL<br>
&nbsp; END #CLASS<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">Many thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin:0in;margin-bottom:.0001pt">Robert<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in">
<br>
&gt;&gt;&gt; &quot;Anzel, Phil - Fort Collins, CO&quot; &lt;Phil.Anzel@ftc.usda.gov&gt; 7/07/2011 2:11 a.m. &gt;&gt;&gt;<br>
Hi, Robert,<br>
<br>
A simple approach would be to generate a pseudo-random color based upon a value unique to each record in your source data. For example, in the following example the source data, pulled from a Microsoft Sql Server database, has an integer column named &quot;ShapeID&quot;:<br>
<br>
&nbsp; layer<br>
&nbsp;&nbsp;&nbsp; name &quot;mupolygon&quot;<br>
&nbsp;&nbsp;&nbsp; status on<br>
&nbsp;&nbsp;&nbsp; connectiontype plugin<br>
&nbsp;&nbsp;&nbsp; plugin &quot;C:/ms4w/Apache/specialplugins/msplugin_mssql2008.dll&quot;<br>
&nbsp;&nbsp;&nbsp; processing &quot;CLOSE_CONNECTION=DEFER&quot;<br>
&nbsp;&nbsp;&nbsp; connection &quot;server=...;&quot;<br>
&nbsp;&nbsp;&nbsp; projection 'init=epsg:4269' END&nbsp;&nbsp; # NAD83<br>
&nbsp;&nbsp;&nbsp; units DD<br>
&nbsp;&nbsp;&nbsp; DATA &quot;shapeGeometry from soilmu_a_wy721_nad83 using unique shapeID using SRID=4269&quot;<br>
&nbsp;&nbsp;&nbsp; type polygon<br>
&nbsp;&nbsp;&nbsp; opacity 40<br>
&nbsp;&nbsp;&nbsp; class<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name &quot;mupoly&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR [convert(varchar(3), (128 &#43; shapeID) % 253) &#43; ' ' &#43; convert(varchar(3), (200 &#43; shapeID) % 254) &#43; ' ' &#43; convert(varchar(3), (64 &#43; shapeID) % 255)]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outlinecolor 0 0 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outlinewidth 1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br>
&nbsp;&nbsp;&nbsp; end&nbsp; # of class &quot;mupoly&quot;<br>
&nbsp; end # of layer &quot;mupolygon&quot;<br>
<br>
In the context used above, the content of COLOR's specification (everything between the square brackets) is passed on as part of the SQL statement generated and transmitted to the database engine. Many variations are possible. Note that this approach does not
 provide any protection against the unlikely case where adjacent polygons display the same color.<br>
<br>
I cannot speak to using data from other data sources. Best of luck with this.<br>
<br>
- Phil Anzel<br>
&nbsp; Web Soil Survey developer<br>
&nbsp; Vistronix Inc for USDA/NRCS/ITC<br>
<br>
<br>
-----Original Message-----<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 06 Jul 2011 09:08:28 &#43;1200<br>
From: &quot;Robert Sanson&quot; &lt;Robert.Sanson@asurequality.com&gt;<br>
Subject: [mapserver-users] Random colours for polygon fill?<br>
To: &lt;mapserver-users@lists.osgeo.org&gt;<br>
Message-ID: &lt;4E14260B.379F.0037.1@asurequality.com&gt;<br>
Content-Type: text/plain; charset=&quot;us-ascii&quot;<br>
<br>
Dear Mapserver users<br>
<br>
Just wondering if it is possible to colour a polygon Shape file layer with each distinct polygon having a different colour?<br>
<br>
Many thanks,<br>
<br>
Robert Sanson<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in">
<o:p>&nbsp;</o:p></p>
<p align="center" style="text-align:center"><span style="background:white">This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email
 from your system.</span><o:p></o:p></p>
<p align="center" style="text-align:center"><span style="background:white">This message has been scanned for Malware and Viruses by Websense Hosted Security.
</span><a href="http://www.websense.com/"><span style="color:black;background:white">www.websense.com</span></a><o:p></o:p></p>
</div>
</body>
</html>