PHP MapScript / dynamic points from MySQL / possible to query?

Peter Giencke pgiencke at GLC.ORG
Tue Jul 19 12:53:51 EDT 2005


Jeff,

One idea is by writing those points to a javascript array, you could
implement a js function to access the array (via mouseclick or whatever) and
present the data in any number of ways. You could keep your code relatively
intact for this by having the php write all the javascript necessary for
this.

-pete
 
Pete Giencke
Data and Information Management
Great Lakes Commission 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Geoff Rowland
Sent: Tuesday, July 19, 2005 12:36 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] PHP MapScript / dynamic points from MySQL /
possible to query?

I am pulling some lat/lon coordinates out of a database and drawing them on
a map using code like this (not sure if this is really the best way, but
it's the code I came up with, heh)

$map= ms_newMapObj('world.map');
$layer = $map->getLayerByName('alerts');

for ($j=0; $j < mysql_num_rows($result); $j++)
    {
        $row = mysql_fetch_assoc($result);
        ${$pt} = ms_newPointObj();
        ${$pt}->setXY($row[lat],$row[lon]);
        ${$pt}->draw($map, $layer, $img, 0 ,$row[location]);
    }
$url = $img->saveWebImage();

works great.  However I really want to make it so that when a user clicks on
the point, information about the point will come up.  I assume this is not
possible with the way I currently have this setup, is that correct?  What
would be the best way to go about doing this?

Cheers,
Geoff

--
Geoffrey Rowland
Technical Officer
Climate Information Project
NOAA Research
Office of  Global Programs
http://www.cip.noaa.gov
http://www.ranetproject.net
Contractor,
RGII Technologies, Inc., a Computer Horizons Company http://www.rg2.com
Phone: 301-427-2344
Fax : 301-427-2082
geoffrey.rowland at noaa.gov



More information about the mapserver-users mailing list