[mapserver-users] create attributes for dynamic polygon layer

Pietro Giannini pgiannini at bytewise.it
Wed Jan 28 02:14:37 PST 2009


I was engaged in a similar question.
It is not possible, you must to try a different method.
Read this thread:
http://lists.osgeo.org/pipermail/mapserver-users/2009-January/059537.html

ciao  .........pg

-- 
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E



On Mar, Gennaio 27, 2009 16:37, Mathias Tobler wrote:
> <html>
> <body>
> <font size=3>I sent this (probably wrongly) to the mapserver-dev list a
> couple about a week ago and have not heard back from anyone. So I am
> trying my luck here.<br><br>
> 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->set("text",$label); works great
> for labeling 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->set( "name", "ColDensity");<br>
> $oLayerPoly->set( "type", MS_LAYER_POLYGON);<br>
> $oLayerPoly->set( "status", MS_DEFAULT);<br><br>
> foreach($summary_rows as $row)<br>
> {<br>
> $oNewLine = ms_newLineObj();<br>
> $oNewLine->addXY($row['minLong'],$row['minLat']);<br>
> $oNewLine->addXY($row['minLong']+1,$row['minLat']);<br>
> $oNewLine->addXY($row['minLong']+1,$row['minLat']+1);<br>
> $oNewLine->addXY($row['minLong'],$row['minLat']+1);<br>
> $oNewLine->addXY($row['minLong'],$row['minLat']);<br>
> <x-tab>        </x-tab><x-tab>
>         </x-tab>  
> <br>
> $oNewShape = ms_newShapeObj(MS_SHAPE_POLYGON);<br>
> $oNewShape->add($oNewLine);<br>
> <x-tab>        </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><br>
> $label = $row['Count'];<br>
> <x-tab>        </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><br>
> $oNewShape->set("text",$label);<br>
> <x-tab>        </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><x-tab>
>         </x-tab><br>
> $oLayerPoly->AddFeature($oNewShape);<br>
> <x-tab>        </x-tab><x-tab>
>         </x-tab><br>
> } </font></body>
> </html>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>






More information about the MapServer-users mailing list