[mapserver-users] phpmapscript on feature text
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Apr 1 16:57:39 PST 2002
Aaron,
Yes you can do that. Define the layer in the map file with an empty
FEATURE END block. Then in PHP/Mapscript create a ShapeObj and add a
point with the location where you want the label to go and add the text
string to the ShapeObj. the get the Layer by name, and
$oLayer->addFeature($oshape); and draw the layer. I haven't actually
done this but I think it should work. Let us know the results. So
something like this:
$oPoint = ms_newLineObj(); # shape wants a line object as list of
points
$oPoint->setXY($myX, $myY);
$oShape = ms_newShapeObj(MS_SHAPE_POINT);
$oShape->set("text", "© 2002 Name of Copyright Owner");
$oShape->add($oPoint);
$oLayer = $map->getLayerByName("release");
$oLayer->addFeature($oShape);
$image = $map->draw();
$oLayer->draw($image);
Or something very close to this anyway.
-Steve W.
> "Aaron D. Hunt" wrote:
>
> Thank you for the help on the credits.
>
> Is there a way to change the text in the feature area with php
> mapscript ?
>
> LAYER
> NAME release
> STATUS DEFAULT
> TRANSFORM FALSE
> TYPE ANNOTATION
> FEATURE
> POINTS 555 260 END
> TEXT '© 2002 '
> END
> CLASS
> LABEL
> TYPE TRUETYPE
> FONT Times
> SIZE 8
> ANTIALIAS
> OUTLINECOLOR 255 255 255
> COLOR 0 0 0
> POSITION UL
> FORCE TRUE
> END
> END
> END
>
> Aaron D. Hunt
> Technical Manager
> ZedX Inc.
> Voice: 814-357-8490
> Fax: 814-357-8499
More information about the MapServer-users
mailing list