[Mapserver-users] dynamic label mysql
joerg pfeiffer
listen at superbla.net
Wed Apr 7 14:33:40 PDT 2004
Hello,
I tried and tried, but somehow it doesn't work:
I get some point cords and the labels text from mysql. I can draw the
points, but how do I get the labels drawn??
Joerg
The part in Php mapscript file:
$map_path="";
$map_file="mapVorschau.map";
$map = ms_newMapObj($map_path.$map_file);
$image = $map->prepareImage();
$locationLayerObj = $map->getLayerByName("location");
$locationLineObj = ms_newLineObj();
$locationpointObj = ms_newPointObj();
$testlayer = $map->getLayerByName("locationnamen");
for ($i = 0; $i < count($latlongliste); $i++){
$locationpointObj->setXY($latlongliste[$i][1],$latlongliste[$i][0]);
$locationLineObj ->add($locationpointObj);
$locationshp = ms_newShapeObj(MS_SHAPE_POINT);
$locationshp->add($locationLineObj);
$testpt = ms_newPointObj();
$testpt->setXY($latlongliste[$i][1],$latlongliste[$i][0]);
$testpt->draw($map, $testlayer, $image, 'locationnamen',
'Hello World');
if($locationLayerObj->addFeature($locationshp) == -1){
echo "addFeature in locationKarte Layer
failed";
}
}
$image=$map->draw();
LAYER ############## 'locationnamen'
NAME 'locationnamen'
STATUS on
TYPE annotation
PROJECTION
"init=epsg:4326"
END
CLASS
NAME 'locationnamen'
LABEL
type truetype
font tahoma-bold
size 9
color 0 0 0
position UR
END
END
END
More information about the MapServer-users
mailing list