[mapserver-users] Question about php mapscript

Zhao Ying (CDU) Ying.Zhao1 at cn.flextronics.com
Wed Jul 2 05:42:00 EDT 2008


Greetings,

 

About the following mapscript code, I don't understand very well.

Is it about to generate a new feature node with line, point object
embedded? 

Will it do some updates to the map file stored in the server?

 

 

/* $qresult: an array that corresponds to the fetched rows.*/

function AddPoints ( $map, $qresult ) {

 

     // Use lat/long info from query results to add points 

     // to the points-of-interest layer of the map

     // shape index is set to the store-id 

     // (this requires a patched version of Mapscript)

 

     $this_layer = $map->getLayerByName('poi');

 

     $i = 0;

     foreach($qresult as $row) {

        $poi[$i] = ms_newPointObj();

        $ln[$i] =  ms_newLineObj();

        $shp[$i] = ms_newShapeObj(MS_SHAPE_POINT);

 

      /* $row[2] is latitude,$row[3] is longtitude from database*/

        $poi[$i]->setXY($row[3],$row[2]); 

        $ln[$i]->add($poi[$i]);      

        $shp[$i]->add($ln[$i]);

 

     /* $row[0] is address field from database. */

        $shp[$i]->set(index, $row[0]); 

        $this_layer->addFeature( $shp[$i] );

        $i++;

     }

 

     return;

 

} // end AddPoints

 

Thanks!

 

Jeff

Chengdu China.


Legal Disclaimer:
The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080702/711cb4cf/attachment-0001.html


More information about the mapserver-users mailing list