[Mapserver-users] help with annotations

Matt Doggett mdoggett at coas.oregonstate.edu
Mon Sep 22 16:35:55 PDT 2003


This is exactly what I'm doing except I'm using TYPE POINT, rather than
TYPE ANNOTATION.  So what's the difference between POINT and ANNOTATION?
Let me guess, A POINT layer has both a point SYMBOL and a LABEL at each
x,y coordinate of the points in the layer. But the ANNOTATION layer has
only a LABEL at each of the points.  Is this correct?  Perhaps I've come
full circle now back to my original question trying to understand
annotation layers (of which I still have not found an adequate
explanation).

Matt

>-----Original Message-----
>From: Dylan Keon [mailto:keon at nacse.org]
>Sent: Monday, September 22, 2003 4:27 PM
>To: mdoggett at coas.oregonstate.edu
>Cc: mapserver-users at lists.gis.umn.edu
>Subject: Re: [Mapserver-users] help with annotations
>
>Matt,
>
>I'm not sure this is what you're after, but in one of my PHP apps I
>label dynamically-created lines with text from user input.  Assuming
you
>want to build your label text from database content, just run the
query,
>construct your several-item label ahead of time, and assign it to a
>variable (or push the labels into an array).  That variable would
>replace "$label[$i]" in the code example below (which is part of a for
>loop that adds the labels after I've rendered the lines):
>
>   $pt = ms_newLineObj();
>   $pt->addXY($x, $y);
>
>   $shape = ms_newShapeObj(MS_SHAPE_POINT);
>
>   $shape->set('classindex', 0);
>
>   $shape->set('text', $label[$i]);  // assign the label
>
>   $shape->add($pt);
>
>   $layer = $map->getLayerByName('line_annotation');
>
>   $shape->draw($map, $layer, $image);
>
>   $pt->free();
>
>   $shape->free();
>
>Here's the corresponding entry in my mapfile:
>
>LAYER
>   NAME line_annotation
>   STATUS ON
>   TYPE ANNOTATION
>   FEATURE
>   END
>   CLASS
>     LABEL
>       TYPE TRUETYPE
>       FONT arial
>       SIZE 10
>       COLOR 0 0 0
>       POSITION UC
>       FORCE TRUE
>     END
>   END
>END
>
>
>--Dylan
>
>--
>**************************************************************
>  Dylan Keon - GIS/Database Specialist
>  Northwest Alliance for Computational Science and Engineering
>  Oregon State University
>  Corvallis, OR 97331
>  keon at nacse.org     voice: 541-737-6608     fax: 541-737-6609
>**************************************************************
>
>Matt Doggett wrote:
>
>> Someone else had suggested this same technique, and I've seen it in
the
>> documentation. But where do the values [FIRSTNAME] [LASTNAME] come
from?
>> My guess is that they are attribute 'columns' in the shape file.  But
>> here's the problem.  My shape object is created dynamically with
>> Php/Mapscript (from a query to a postgres database).  I see that the
>> ShapeObj class has the values array but apparently it is read-only so
>> that I cannot dynamically create the data columns
>> ([TEMP],[DEWPT],[WIND], etc) that this method would require.  This
>> problem is off topic but are there any suggestions?
>>
>> md
>>
>>
>>>-----Original Message-----
>>>From: mapserver-users-admin at lists.gis.umn.edu
[mailto:mapserver-users-
>>>admin at lists.gis.umn.edu] On Behalf Of Lowell Filak
>>>Sent: Monday, September 22, 2003 1:04 PM
>>>To: Matt Doggett; 'Tyler Mitchell'; mapserver-users at lists.gis.umn.edu
>>>Subject: RE: [Mapserver-users] help with annotations
>>>
>>>You can specify multiple 'text' attributes for the class, ie.
>>>([FIRSTNAME],[LASTNAME]) .
>>>Lowell
>>>
>>>The following message was sent by "Matt Doggett"
>>><mdoggett at coas.oregonstate.edu> on Mon, 22 Sep 2003 12:36:53 -0700.
>>>
>>>
>>>>Well, I have a single point layer that contains weather station
data.
>>
>> I
>>
>>>>currently have it so that the label (actually the 'text' attribute
of
>>>>the shape object) contains the station identifier. In addition to
>>
>> this,
>>
>>>>I also would like to be able to display one, some, all of additional
>>>>data like temp, dewpt, winds, etc.
>>>>None of the responses so far has suggested annotations so maybe
>>
>> that's
>>
>>>>not the direction I need to be going.
>>>>
>>>>matt
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: mapserver-users-admin at lists.gis.umn.edu
>>
>> [mailto:mapserver-users-
>>
>>>>>admin at lists.gis.umn.edu] On Behalf Of Tyler Mitchell
>>>>>Sent: Monday, September 22, 2003 11:18 AM
>>>>>To: mapserver-users at lists.gis.umn.edu
>>>>>Subject: Re: [Mapserver-users] help with annotations
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>Do you just want to create labels that use more than one line (i.e.
>>>>>multi-line labels) and use more than one attribute?  Are you
already
>>>>>displaying labels okay?  You can do all this using similar
>>
>> methodology
>>
>>>>as
>>>>
>>>>>far as I know.   Maybe give us a short example of what you are
>>
>> already
>>
>>>>>doing and how you'd like that to change.
>>>>>
>>>>>Tyler
>>>>>
>>>>>mapserver-users-admin at lists.gis.umn.edu wrote on 09/22/2003
10:45:36
>>>>
>>>>AM:
>>>>
>>>>>>I have some point data where I want to display more than one data
>>>>
>>>>value
>>>>
>>>>>in
>>>>>
>>>>>>the labels at each data point (eg. Temperature, windspeed, dewpt,
>>>>
>>>>etc).
>>>>
>>>>>How
>>>>>
>>>>>>would I do this?  I'm thinking that this would involve annotation
>>>>
>>>>layers
>>>>
>>>>>but
>>>>>
>>>>>>I can't find any documentation that says exactly what they are or
>>
>> how
>>
>>>>to
>>>>
>>>>>use
>>>>>
>>>>>>them.  Can anyone shed some light on how to use annotation layers?
>>>>
>>>>I'm
>>>>
>>>>>>using PHP/Mapscript if that helps.
>>>>>>
>>>>>>TIA,
>>>>>>
>>>>>>Matt
>>>>>>
>>>>>>Matt Doggett
>>>>>>Spatial Climate Analysis Service
>>>>>>Oregon State University
>>>>>>316 Strand Ag Hall
>>>>>>Corvallis, OR 97331
>>>>>>(541)737-9153
>>>>>>mdoggett at coas.oregonstate.edu
>>>>>>
>>>>>>
>>>>>>[attachment "winmail.dat" deleted by Tyler Mitchell/Lignum]
>>>>>
>>>>>_______________________________________________
>>>>>Mapserver-users mailing list
>>>>>Mapserver-users at lists.gis.umn.edu
>>>>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>>>
>>>>_______________________________________________
>>>>Mapserver-users mailing list
>>>>Mapserver-users at lists.gis.umn.edu
>>>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>>
>>>_______________________________________________
>>>Mapserver-users mailing list
>>>Mapserver-users at lists.gis.umn.edu
>>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>
>>
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>





More information about the MapServer-users mailing list