Change Text of Feature Object/Inline Feature
ClackJim
jimlug at CO.CLACKAMAS.OR.US
Fri Aug 17 11:04:52 PDT 2007
Ok, since I found it hard to get a response I will create my own:-{. After
digging deep I realized I should move my text from the so called "Feature
Object" to Class. I was then able to access the text of the Class Object
and change my copyright information using settext. Here is a snippet of the
code:
$coLyr = $map->getLayerByName('copyright');
$coClass = $coLyr->getclass(0);
// Previous text was 'Aloha'
$coClass->settext('Aloha Friday');
ClackJim wrote:
>
> Aloha folks,
>
> I am trying to change the text of a so-called Feature Object using
> MapScript. When I have the code within the MapFile, everything works just
> fine. However, when I try to use MapScript I am unable to change the
> text.
> I've tried several different techniques and searched all over for the
> answer. Attached is a sample of my code within my MapFile:
>
> #---Copyright---#
> LAYER
> NAME copyright
> STATUS ON
> TYPE annotation
> TRANSFORM false
> FEATURE
> POINTS
> 70 535
> END
> TEXT "© Clackamas County 2006"
> END
> CLASS
> LABEL
> FONT arial
> TYPE TRUETYPE
> SIZE 8
> BUFFER 1
> COLOR 0 0 0
> BACKGROUNDCOLOR 255 255 255
> FORCE TRUE
> END
> END
> END
>
> $coLyr = $map->getLayerByName('copyright');
> $coShp =$coLyr->getShape(-1,0);
> $coText = $coShp->text;
> echo $coText . "</br>";
> $coNewText = "©" . "Clackamas County 2006 - Aerial 2005" ;
> $coShp->set('text',$coNewText);
> $coText = $coShp->text;
> echo "New text is " . $coText;
>
> I thought this should work since I am verifying the new text with the
> second echo. Does anyone have any suggestion?
>
>
--
View this message in context: http://www.nabble.com/Change-Text-of-Feature-Object-Inline-Feature-tf4280302.html#a12204426
Sent from the Mapserver - User mailing list archive at Nabble.com.
More information about the MapServer-users
mailing list