<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>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</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is my layer:</DIV>
<DIV>&nbsp;</DIV>
<DIV>LAYER<BR>&nbsp; NAME fbnd<BR>&nbsp; GROUP "CRS"<BR>&nbsp; TYPE POLYGON<BR>&nbsp; STATUS ON<BR>&nbsp; CONNECTIONTYPE SDE<BR>&nbsp; CONNECTIONTYPE PLUGIN<BR>&nbsp; PLUGIN "d:/ms4w/apache/specialplugins/msplugin_sde_93.dll"<BR>&nbsp; CONNECTION "db-esri,port:5155,cadastre,user,pass"<BR>&nbsp; DATA "CADASTRE.SDEADMIN.VW_FARM_BOUNDARY_SP,SHAPE"<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 "fbnd"<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 + convert(int,env_min_x)) % 253)) + " " + convert(varchar(3), ((200 + convert(int,env_min_x)) % 254)) + " " + convert(varchar(3), ((64 + 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 "arial"<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<BR></DIV>
<DIV>Many thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert</DIV>
<DIV><BR>&gt;&gt;&gt; "Anzel, Phil - Fort Collins, CO" &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 "ShapeID":<BR><BR>&nbsp; layer<BR>&nbsp;&nbsp;&nbsp; name "mupolygon"<BR>&nbsp;&nbsp;&nbsp; status on<BR>&nbsp;&nbsp;&nbsp; connectiontype plugin<BR>&nbsp;&nbsp;&nbsp; plugin "C:/ms4w/Apache/specialplugins/msplugin_mssql2008.dll"<BR>&nbsp;&nbsp;&nbsp; processing "CLOSE_CONNECTION=DEFER"<BR>&nbsp;&nbsp;&nbsp; connection "server=...;"<BR>&nbsp;&nbsp;&nbsp; projection 'init=epsg:4269' END&nbsp;&nbsp; # NAD83<BR>&nbsp;&nbsp;&nbsp; units DD<BR>&nbsp;&nbsp;&nbsp; DATA "shapeGeometry from soilmu_a_wy721_nad83 using unique shapeID using SRID=4269"<BR>&nbsp;&nbsp;&nbsp; type polygon<BR>&nbsp;&nbsp;&nbsp; opacity 40<BR>&nbsp;&nbsp;&nbsp; class<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name "mupoly"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR [convert(varchar(3), (128 + shapeID) % 253) + ' ' + convert(varchar(3), (200 + shapeID) % 254) + ' ' + convert(varchar(3), (64 + 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 "mupoly"<BR>&nbsp; end # of layer "mupolygon"<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 +1200<BR>From: "Robert Sanson" &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="us-ascii"<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<BR><BR></DIV><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">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.</FONT></P>

<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for Malware and Viruses by Websense Hosted Security.  </FONT><A href="http://www.websense.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.websense.com</FONT></A></P>
</body></HTML>