Labels DO NOT appear on ms_newPointObj()?

Eric Bridger eric at GOMOOS.ORG
Wed Aug 11 14:10:14 EDT 2004


I would try adding, after your $point->draw()

$oMap->drawLableCache($oImage);

Eric



On Wed, 2004-08-11 at 13:10, Ishrar Hussain wrote:
> I am using the code below to plot a dynamic point
> using ms_newPointObj(). Though I have added the LABEL
> object inside the CLASS object of the LAYER which
> contains the point, the label does not appear at all.
>
> Please go through the code, and let me know if it
> needs any change for making the label appear. I'm also
> not sure whether the parameter for the annotation
> string in ms_newPointObj() will be the one holding the
> LABEL of the point.
>
> The code is as follows:
>
> <?php
> //....Part of my PHP Code
>
> $oImage = $oMap->draw();
>
> $myPoint = ms_newPointObj();
> $myPoint->setXY(542800.6235, 626730.4673);
> $myLayer = $oMap->getLayerByName("Points");
>
> $myPoint->draw($oMap, $myLayer, $oImage, 0, "The LABEL
> of This Point");
>
> //....continues
> ?>
>
>
> # Part of my Map File
>
>   LAYER
>     NAME "Points"
>     STATUS DEFAULT
>     TYPE POINT
>     UNITS METERS
>     SIZEUNITS PIXELS
> #   LABELITEM "Labels" # <-- I'm not sure about
> LABELITEM here
>     LABELMINSCALE 1e+04
>     LABELMAXSCALE 4300000
>     TOLERANCE 0
>     TOLERANCEUNITS PIXELS
>     CLASS
>       NAME "Vehicle Class"
>       LABEL
>         TYPE TRUETYPE
>         FONT "fritqat"
>         SIZE 7
>         MINSIZE 4
>         MAXSIZE 256
>         POSITION CC
>         OFFSET 0 0
>         ANGLE 0
>         BUFFER 0
>         MINDISTANCE -1
>         MINFEATURESIZE -1
>         COLOR 102 51 51
>         OUTLINECOLOR 204 255 204
>         ANTIALIAS TRUE
>         PARTIALS FALSE
>         FORCE FALSE
>       END #LABEL
>       STYLE
>         SYMBOL 2
>         COLOR 171 60 219
>         SIZE 10
>         MINSIZE 1
>         MAXSIZE 100
>       END #STYLE
>     END #CLASS
>   END #LAYER
>
> # -----
>
>
> I hope this will be enough for you to understand the
> problem. looking forward to your early response.
>
> Thank you.
>
> Regards,
> Ishrar
>
>
>
>
> --- Eric Bridger <eric at GOMOOS.ORG> wrote:
>
> > On Sun, 2004-08-08 at 09:37, Ishrar Hussain wrote:
> > > I need to dynamically add labels to the points,
> > which I
> > > plotted with ms_newPointObj() following the code
> > by
> > > Merlos (available at
> >
> http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptAddPoint).
> > >
> > > The annotation string, which I put in the draw()
> > > function of PointObj, does not appear as Label of
> > the point.
> > >
> > > Please, also let me know, if I have to add
> > anything to
> > > my Map file for this, and if so, then how.
> > >
> >
> >
> > You will need to add a LABEL section to your CLASS.
> > E.g.
> >   LABEL
> >     COLOR 255 0 0
> >     SIZE TINY
> >   END
> >



More information about the mapserver-users mailing list