problem plotting points on map using PHP/MapServer

Ben Sims benjaminsims at YAHOO.COM
Mon Sep 11 19:31:40 PDT 2006


Hi to all,

I'm trying out Mapserver, accessed through the PHP API running on my OSX dev machine. Specifically, I'm trying to draw a basic map, then plot some points on it, all done dynamically through the PHP script (ie without using a map file.

So far, I can draw the basic map with a country outline. However, I am unable to draw points on the map.

I have set up the basic map, and added a class and a layer for the points. I then run the following code:

$image=$map->draw();
$point = ms_newPointObj();
$point->setXY(-21.97, 64.15);
$return = $point->draw($map, $pointsLayer, $image, 0, 'A beautiful point');

$return is 0. 

Is there any way I can get further information as to what might be going wrong here, with more detail than just the success/failure methods?


Couple of minor questions I would also appreciate advice on:

Apparently the PHP function ms_newMapObj() must have a map file passed to it, although I noticed that the Python version does not. Is there a reason for this? At the moment, I have a dummy map file containing nothing which I have to use.

If I use something like $layer->name = 'Layername', the layer name is not set (in fact it is set to null). Using $layer->set('name', 'Layername') it seems fine. Not really a problem, just wondered why.

Thanks to all for considering this - would very much appreciate it if you could point me in the right direction.

Regards,
Benjamin



More information about the MapServer-users mailing list