<html>
<body>
<font size=3>I am using PHP MapScript to create a polygon layer based on
data stored in a MySQL database. The layer will show 1x1 degree grid
cells and each cell should be colored according to the number of point
records it contains. The summary is don in SQL and the query returns the
coordinates of the lower left corner of each cell as well as a column
'Count' with the number of recrods in each cell. The geometry part work
fine but I would like to add an attribute so I can assign different
collors to the polygons. While
$oNewShape-&gt;set(&quot;text&quot;,$label); works great to lable
polygons I wonder if there was a similar methods that will work with the
EXPRESSION statement so that I can define different classes for the
layer. Using MySQL is given by our application and I won't be able to
switch to PostGIS. Any suggestions are wellcome. <br><br>
Mathias<br><br>
<br>
# Create a layer to hold density polygons<br>
$oLayerPoly = ms_newLayerObj($oMap);<br>
$oLayerPoly-&gt;set( &quot;name&quot;, &quot;ColDensity&quot;);<br>
$oLayerPoly-&gt;set( &quot;type&quot;, MS_LAYER_POLYGON);<br>
$oLayerPoly-&gt;set( &quot;status&quot;, MS_DEFAULT);<br><br>
foreach($summary_rows as $row)<br>
{<br>
$oNewLine = ms_newLineObj();<br>
$oNewLine-&gt;addXY($row['minLong'],$row['minLat']);<br>
$oNewLine-&gt;addXY($row['minLong']+1,$row['minLat']);<br>
$oNewLine-&gt;addXY($row['minLong']+1,$row['minLat']+1);<br>
$oNewLine-&gt;addXY($row['minLong'],$row['minLat']+1);<br>
$oNewLine-&gt;addXY($row['minLong'],$row['minLat']);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;
<br>
$oNewShape = ms_newShapeObj(MS_SHAPE_POLYGON);<br>
$oNewShape-&gt;add($oNewLine);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
$label = $row['Count'];<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
$oNewShape-&gt;set(&quot;text&quot;,$label);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
$oLayerPoly-&gt;AddFeature($oNewShape);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
}</font></body>
</html>