[Mapserver-users] PHP Mapscript - Can't label dynamic point
Hankley, Chip
Chip.Hankley at GASAI.Com
Fri Dec 20 20:22:47 PST 2002
Folks... I'm using the following code to dynamically generate a point in a
map.
I'm having trouble getting the labeling to work. In the following code, I'm
passing the variable $address_text (which I've checked IS a valid
string)...however, no text is rendering in the image (although the point IS
rendering).
What am I missing?
Chip
//create a layer in which to put the address pin-point
$AddressLayer = createPushPinLyr($map);
//create a point to display
$AddressPoint = createPushPin($addXY);
//generate a map
$img = $map->draw();
$AddressPoint->draw($map, $AddressLayer, $img, 0, $address_text);
function createPushPinLyr($map) {
//create a dynamic layer in which to display the selectd record
$qryLyr = ms_newLayerObj($map);
$qryLyr->set("status", MS_ON);
$qryLyr->set("name", "AddressPushPin");
$qryLyr->set("type", MS_LAYER_POINT);
$qryLyrClass = ms_newClassObj($qryLyr);
$qryLyrClass->set("color", $map->addColor(255, 255 ,0));
$qryLyrClass->set("symbol", 1);
$qryLyrClass->set("size", 25);
$qryLyrClassLbl = $qryLyrClass->label;
$qryLyrClassLbl->set("type", MS_BITMAP);
$qryLyrClassLbl->set("color", $map->addColor(255, 0 ,0));
$qryLyrClassLbl->set("size", MS_SMALL);
$qryLyrClassLbl->set("offsetx", 10);
$qryLyrClassLbl->set("offsety", 10);
return($qryLyr);
}
function createPushPin($addXY) {
$pointObj = ms_newPointObj();
$pointObj->setxy($addXY[0], $addXY[1]);
return $pointObj;
}
More information about the MapServer-users
mailing list