[mapserver-users] Re: How to set Labels dynamically

Ludwig Kniprath ludwig at kni-online.de
Thu Dec 3 13:57:22 PST 2009


Oops, you're right, "drawLabelCache" is a method of the map-object, but 
all the same it works for me!
Perhaps a missing LABEL-Section in the mapfile-definition of your $daLayer?
Regards
Ludwig

Helen Eskina schrieb:
> Hi Ludwig,
>
> Layer object doesn't have DrawLabelCache method. I've tried this line and
> got an error. I'm using Mapserver installed with fgs 5.4.2.
>
> I've tried
>  $map-> drawLabelCache($image);
> But it doesn't make any difference.
>
> Helen
> -----Original Message-----
> From: Ludwig Kniprath [mailto:ludwig at kni-online.de]
> Sent: Thursday, December 03, 2009 12:13 PM
> To: mapserver-users at lists.osgeo.org
> Cc: heskina at ubitech.com
> Subject: RE: How to set Labels dynamically
>
> Hi,
> I think there's only one line missing after $daLayer->draw($image):
>
> $daLayer->drawLabelCache($image);
>
> Regards
> Ludwig
>
>   
>> Message: 6
>> Date: Thu, 3 Dec 2009 11:13:10 -0500
>> From: Helen Eskina <heskina at ubitech.com>
>> Subject: [mapserver-users] How to set Labels dynamically?
>> To: mapserver-users at lists.osgeo.org
>> Message-ID: <5CDE4E2F906F4CE9B22AFEDB42CD00F0 at SkySource>
>> Content-Type: text/plain; charset="windows-1252"
>>
>> Hello,
>>
>>
>>
>> I couldn't find documentation how to set the text labels dynamically
>>     
> using
>   
>> MapScript.
>>
>> My application should show points with labels on the map. Points and
>>     
> labels
>   
>> are obtained dynamically from the database or some text file.
>>
>> I add the points to the layer and draw layer as following:
>>
>>
>>
>> $my_point = ms_newpointObj();
>>
>>
>>
>> $my_point->setXY(-75.895, 45.9227);
>>
>> $my_point->project($projInObj,$projOutObj);
>>
>>
>>
>> $line = ms_newLineObj();
>>
>> $line->add($my_point);
>>
>> $shape = ms_newShapeObj(MS_SHAPE_POINT);
>>
>> $shape->add($line);
>>
>> $shape->set(text, 'new point');
>>
>> $daLayer->addFeature($shape);
>>
>>
>>
>> $image=$map->draw();
>>
>> $daLayer->draw($image);
>>
>> $image_url=$image->saveWebImage();
>>
>>
>>
>> Points are displayed on the map, but no text. What am I doing wrong?
>>
>>
>>
>> I will appreciate any help,
>>
>> Helen
>>     
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.426 / Virus Database: 270.14.88/2538 - Release Date: 12/03/09
> 07:32:00
>   




More information about the MapServer-users mailing list