Labels DO NOT appear on ms_newPointObj()?
Eric Bridger
eric at GOMOOS.ORG
Thu Aug 12 17:07:44 PDT 2004
If $map->drawLabelCache() is returning an error you should check the mapserver error log.
You should not need a LABELITEM, you are providing the text. I would also try removing the LABELMAXSCALE, LABELMINSCALE items
and try setting FORCE TRUE in you LABEL.
At 04:39 PM 08/12/2004 -0700, Ishrar Hussain wrote:
>Dear Eric,
>
>I tried using drawLableCache() as you've mentioned.
>But it gives error (returns -1). Thus, the problem
>still persists.
>
>Seeing the code, can anyone also suggest me what I
>should put in LABELITEM of LAYER object in the map
>file, when using ms_newPointObj() to draw label on a
>dynamic point?
>
>Thank you.
>
>Regards,
>Ishrar
>
>
>
>--- Eric Bridger <eric at gomoos.org> wrote:
>
>> 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
>> > >
>>
>>
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
More information about the MapServer-users
mailing list