[non-spatial]-mysql: point data source

Kristjan Annus kristjan at TARKVARASTUUDIO.EE
Wed Dec 29 03:13:23 EST 2004


This is how I do it with PHPMapscript (its a fragment of code from
larger application
that shows public transportation of a city):

$layer = $map->getLayerByName('bus_stops');

$cmd = "SELECT x, y from bus_stops";
mysql_query( $cmd);
$result = mysql_query($cmd);

while ($myrow=mysql_fetch_array($result)) {
    $x = $myrow["x"];
    $y = $myrow["y"];

    $bus_stop = ms_newPointObj();
    $bus_stop->setXY( $x, $y);
    $bus_stop->draw( $map, $layer, $image, 0, '');
}
}

But can anybody send an example of map file where MySQL spatial
data is used as datasource for Mapserver layer?
Is it possible at all?

>Greetings everyone!
>
>I have been using mapserver for quite some time with shapefiles, and am
>quite pleased with its flexibility.
>
>I was wondering if it would be possible to add point data records, stored
>in a MySQL data base, to a map that was created by shapefiles. The records
>in mysql would be formatted as follows:
>
>point_id, x, y, attribute_1, ...
>
>this is not in the openGIS format that the myGIS connector is using, and
>so I wonder if it is even possible to get a 'list' of points like this
>into a mapserver application.
>
>I would like to use PHPmapscript, but i have problems running PHP as a CGI
>as opposed to the more traditional Apache DSO (maybe this problem has been
>solved...)
>
>any ideas would be greatly appreciated.
>
>Dylan
>
>



More information about the mapserver-users mailing list