<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> </DIV>
<DIV>Here is my layer:</DIV>
<DIV> </DIV>
<DIV>LAYER<BR> NAME fbnd<BR> GROUP "CRS"<BR> TYPE POLYGON<BR> STATUS ON<BR> CONNECTIONTYPE SDE<BR> CONNECTIONTYPE PLUGIN<BR> PLUGIN "d:/ms4w/apache/specialplugins/msplugin_sde_93.dll"<BR> CONNECTION "db-esri,port:5155,cadastre,user,pass"<BR> DATA "CADASTRE.SDEADMIN.VW_FARM_BOUNDARY_SP,SHAPE"<BR> DUMP TRUE<BR> HEADER ../templates/apiaries_query_header.html<BR> TEMPLATE ../templates/apiaries_query_body.html<BR> LABELMAXSCALE 100000<BR> LABELCACHE on<BR> LABELITEM 'key_decision_maker'<BR> MAXSCALE 250000<BR> CLASS<BR> NAME "fbnd"<BR> DEBUG on<BR> STYLE<BR> WIDTH 3<BR> #COLOR 135 206 235<BR> 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> OUTLINECOLOR 0 255 0<BR> END<BR> LABEL<BR> TYPE truetype<BR> FONT "arial"<BR> SIZE 9<BR> POSITION auto<BR> OUTLINECOLOR 255 255 255 #--Halo<BR> COLOR 76 179 145 <BR> MINDISTANCE 50<BR> BUFFER 2<BR> END #LABEL<BR> END #CLASS<BR></DIV>
<DIV>Many thanks,</DIV>
<DIV> </DIV>
<DIV>Robert</DIV>
<DIV><BR>>>> "Anzel, Phil - Fort Collins, CO" <Phil.Anzel@ftc.usda.gov> 7/07/2011 2:11 a.m. >>><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> layer<BR> name "mupolygon"<BR> status on<BR> connectiontype plugin<BR> plugin "C:/ms4w/Apache/specialplugins/msplugin_mssql2008.dll"<BR> processing "CLOSE_CONNECTION=DEFER"<BR> connection "server=...;"<BR> projection 'init=epsg:4269' END # NAD83<BR> units DD<BR> DATA "shapeGeometry from soilmu_a_wy721_nad83 using unique shapeID using SRID=4269"<BR> type polygon<BR> opacity 40<BR> class<BR> name "mupoly"<BR> style<BR> COLOR [convert(varchar(3), (128 + shapeID) % 253) + ' ' + convert(varchar(3), (200 + shapeID) % 254) + ' ' + convert(varchar(3), (64 + shapeID) % 255)]<BR> outlinecolor 0 0 0<BR> outlinewidth 1<BR> end<BR> end # of class "mupoly"<BR> 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> Web Soil Survey developer<BR> 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" <Robert.Sanson@asurequality.com><BR>Subject: [mapserver-users] Random colours for polygon fill?<BR>To: <mapserver-users@lists.osgeo.org><BR>Message-ID: <4E14260B.379F.0037.1@asurequality.com><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>