[mapserver-users] Displaying a string instead of a label

Charlotte Declercq c.declercq at alkante.com
Wed Jul 15 04:19:03 EDT 2009


Hi Adrian,

You can set the TEXT property of the CLASS object like this :

CLASS
  NAME "departement"
  LABEL
    ANGLE 0.000000
    ANTIALIAS TRUE
    FONT "Arial"
    MAXSIZE 256
    MINSIZE 4
    SIZE 8
    TYPE TRUETYPE
    BUFFER 0
    COLOR 0 0 0
    FORCE FALSE
    MINDISTANCE -1
    MINFEATURESIZE -1
    OFFSET 1 1
    PARTIALS TRUE
    POSITION CC
    SHADOWCOLOR 0 0 0
  END
  STYLE
    ANGLE 360
    COLOR 232 246 9
    OPACITY 100
    SIZE 10
    SYMBOL "Carre"
  END
  TEXT "my static text"
END

It will override the label. You don't need CLASSITEM, LABELITEM, 
LABELMAXSCALEDENOM and LABELMINSCADENOM but you need the LABEL object.
The documentation is here : http://mapserver.org/mapfile/class.html

/TEXT [string]/
    /Static text to label features in this class with. This overrides
    values obtained from the LABELTIEM. The string may be given as an
    expression delimited using the ()’s. This allows you to concatenate
    multiple attributes into a single label. For example:
    ([FIRSTNAME],[LASTNAME])./


I think you can set the TEXT property on classical layer types such as 
POLYGON, LINE, POINT, not only ANNOTATION.
If you use ANNOTATION, then the text will be placed at the centroid of 
the polygon of the middle of the line.

Regards,

-- 
Charlotte DECLERCQ

ALKANTE SAS
Ingénieur R&D SIG
1, rue du Chêne Morand
35 510 Cesson-Sévigné
Bur: + 33 (0) 2 99 22 25 70
fax : + 33 (0) 2 99 32 12 76





Adrian Popa a écrit :
> Hi everybody,
>
> Can someone point me to the relevant part of the documentation/example 
> that shows how to display a static string (set at the layer level) for 
> a layer instead of displaying a label? Does 'annotation' have anything 
> to do with this?
>
> Thanks,
> Adrian
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>






More information about the mapserver-users mailing list