[Mapserver-users] pointObj->draw() not working!
Daniel Morissette
dmorissette at dmsolutions.ca
Sat Apr 10 11:02:19 PDT 2004
Ken-ichi Ueda wrote:
> Hi list. Although my previous addPoint problem remains unanswered and
> unsolved, I have yet another problem. For some reason phpMapScript's
> pointObj->draw() isn't working either! I've put together what I think
> is a pretty trivial test of the function, and it doesn't give any error
> messages, but it also doesn't draw the point I want it to. I've
> included my version info and the test script below. Please respond!
> Even if it looks like it should work and you're clueless. I just want a
> little feedback.
>
Something may be missing in your layer definition, but without seeing it
we can't tell. Here is a modified version of your script that creates
its own layer, and does display the symbol properly. You should compare
your layer definition with what is set in this example. Also note that
if you want to draw labels then you may have to either turn the
labelcache off, or call $map->drawLabelCache() after drawing the pointObj.
<?php
dl('php_mapscript.so');
// Default values and configuration
$map_path = "/Library/WebServer/Documents/maplab/projects/Naturalists/";
$map_file = "naturalists.map";
$map = ms_newMapObj($map_path.$map_file);
$daLayer = ms_newLayerObj($map);
$daLayer->set("type", MS_LAYER_POINT);
$daLayer->set("transform", MS_FALSE);
$daLayer->set("status", MS_ON);
$class = ms_newClassObj($daLayer);
$style = ms_newStyleObj($class);
$style->color->setRGB(255,0,0);
$style->set("symbolname", "circle");
$style->set("size", 10);
$my_point = ms_newpointObj();
$my_point->setXY(217,240);
$image = $map->draw();
$my_point->draw( $map, $daLayer, $image, 0, "Temp Point" );
$image_url=$image->saveWebImage();
?>
<html>
<head><title>point draw test</title>
</head>
<body>
<img SRC="<?php echo $image_url?>" align="left">
</body>
</html>
--
------------------------------------------------------------
Daniel Morissette dmorissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
More information about the MapServer-users
mailing list