PERL MapScript: How to change text of a shapeObj?

Gabor Kiss [Bitman] kissg at CDATA.HU
Fri May 12 07:26:10 EDT 2006


Dear folks,

I'm a newbie with MapScript.
I just try to generate an image with some on-the fly computed texts.

I added a layer to mapfile like described on page
http://mapserver.gis.umn.edu/docs/faq/copyright-layer
then I tried to change the text before drawing:

 	$some_text = "some other text";
 	$image = $map->draw;

 	$layer = $map->getLayerByName('my_text');
 	$shape = $layer->getFeature(0);
 	$shape->{text} = $some_text;
 	$line  = $shape->get(0);
 	$point = $line->get(0);
 	$point->setXY(300, 400);
 	$shape->draw($map, $layer, $image);

I can set the text position to (300,400) well
but I cannot change the text appearing on the image.
What to do?
Any hints will be appreciated.

Gabor



More information about the mapserver-users mailing list