PHP/mapscript: verifying syntax on point->draw

A. Giacomelli andreag at crs4.it
Fri Mar 9 10:50:13 EST 2001


Hello,

i would like to plot a series of points whose coordinates are stored in
a database using php/mapscript

this is what I am using now:

            $mys = "select x,y,attr from mytable order by attr";
              $myres = odbc_exec($myconn,$mys);
              while(odbc_fetch_row($myres)) {
                  $x = odbc_result($myres,"x");
                  $y = odbc_result($myres,"y");
		 $att = odbc_result($myres,"att")

                  $mypoint = ms_newpointobj();
                  $mypoint->setXY($x,$y);
                  $mypoint->draw($gpoMap,$mylayer,$img,"percorso",$att);
                  $mypoint->free();
              }
$img = $myMap->draw();
url = $img->saveWebImage(0, 0);
.....


this is the layer definition for "mylayer"
==============
....
LAYER
   NAME x
   TYPE POINT
   STATUS on
   DATA rice #....this is 
   CLASS
      COLOR 30 30 30
      NAME "path"
      SYMBOL 6
      SIZE 10
   END
END
....
=================

results:

1- an apparently random number of points gets drawn from my recordset
each time I access the page
2- I don't see $att drawn as annotation (something missing in the LAYER
definition ?)

What am I getting wrong ?

Could the same be achieved by adding FEATUREs dynamically to the layer ?

TIA for any assistance!



-- 
=========================================
Andrea Giacomelli
Centre for Advanced Studies, Research and
Development in Sardinia
Environment Group

http://www.crs4.it/~andreag
=========================================



More information about the mapserver-users mailing list