Drawing points and lines dynamically

sc sc at BYTRON.COM
Fri Apr 15 05:19:39 EDT 2005


I am trying to plot a point at logitude 0.0, latitude 54.0 (somewhere in the
UK), I am using
mapscript/PHP but nothing appears on my map (no circle and no label).

Below is the PHP code that should be displaying the point.  The map is
loading ok as I have a
map of the UK and various other layers in my map file that I can switch on
and off with no problems.

One thing that I am confused about is to whether or not the layer that I
want to create the point
on has to be already defined in the map file or whether the code below
actually creates a 'dynamic'


$layer = ms_newLayerObj($map);
$layer->set("name", "Route");
$layer->set("type", MS_LAYER_POINT);
$layer->set("status", MS_DEFAULT);
$layer->set("transform", TRUE);

$class = ms_newClassObj($layer);
$class->label->set("font", "arial");
$class->label->color->setRGB(255, 0, 0);

$symbol = $map->getSymbolByName("circle");
$style = ms_newStyleObj($class);
$style->set("symbol", $symbol);
$style->set("size", 8);
$style->color->setRGB(255, 0, 0);

$image = $map->draw();

$point = ms_newPointObj();
$point->setXY(0.0, 54.0);
$point->draw($map, $layer, $image, 0, "test");
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 14/04/2005

More information about the mapserver-users mailing list