Dynamic point layer via mapscript
Camden Daily
cdaily at GMAIL.COM
Thu Dec 30 07:33:22 PST 2004
Thanks for the replies! It's working now. I think the issue was with
when I was calling $image->draw. It should be called before
$point->draw so that the point appears over the rest of the map (I
believe).
My revised and working code is as follows:
$layer = ms_newLayerObj($map);
$layer->set("name", "points");
$layer->set("type", MS_LAYER_POINT);
$layer->set("status", MS_DEFAULT);
$class = ms_newClassObj($layer);
$class->label->set("font", "arial");
$class->label->color->setRGB(255, 0, 0);
$style = ms_newStyleObj($class);
$symbol = $map->getSymbolByName("square");
$style->set("symbol", $symbol);
$style->set("size", 8);
$style->color->setRGB(255, 0, 0);
$image = $map->draw();
$point = ms_newPointObj();
$point->setXY($longitude, $latitude);
$point->draw($map, $layer, $image, 0, "test");
$image_url = $image->saveWebImage('MS_JPG', 1, 1, 0);
More information about the MapServer-users
mailing list