Labels using shape index

Steve Lime steve.lime at DNR.STATE.MN.US
Tue Jul 26 10:40:58 EDT 2005


Eric: This is not doable as the code sits now. You have to label with an attribute, unless, of course, you are drawing features individually using the shapeObj draw method. With that method you pass the label text as part of the method call so the text could be anything at all. There will be a performance and complexity hit should you decide to do that. I would recomend staying with an attribute if at all possible. My question would be why would you want to label with shape id? Since it's not a stable value in many cases.

Steve

>>> Eric Shuman <erics at AMERI-TITLE.COM> 07/22/05 6:32 PM >>>
I'm new to mapserver and am still trying to keep my head above water so
maybe this is very simple, but I have not been able to find a solution so
far...

I have gotten as far as creating a map file, and PHP mapscript that will
query a shapefile by feature and return a map.  I would like to label the
returned features with the index number of the shapes. (ie. 0, 1, 2...)  I
have only been able to get labels from the shapefile attributes themselves
to work.

Is there a way to define the LABELITEM as the ID or shapeindex of the
returned features?

Do I need to create an annotation layer with points for each shape and
define a label value? How???

Can you add a field to the returned featureQuery and calculate the field to
be used as the LABELITEM?

Suggestions, examples, and guidance would be greatly appreciated!  Thanks in
advance.

~Eric



More information about the mapserver-users mailing list