[mapserver-users] How to display Labels from 1 table?

Michael Schulz mschulz at webgis.de
Wed Oct 6 09:45:30 EDT 2010


Hi Theresia,

you can do it via the TEXT keyword in the CLASS section of a layer:
http://www.mapserver.org/mapfile/class.html

e.g. like this:

      CLASS
         LABEL
           COLOR 0 0 0
           TYPE Truetype
           FONT Arial
           SIZE 11
           MINSIZE 8
           ANGLE Auto
           POSITION UC
           ANTIALIAS True
           WRAP "|"
        END # LABEL
        TEXT ([name_region]|[values_1] - [values_2])
     END #CLASS

This will label the features with the values of the tree fields in this form:

name_region
values_1 - values_2

You can request the line break with the WRAP keyword. In recent
mapbender versions there are also keywords to control label alignment.

Cheers, Michael


2010/10/6 elisabeth theresia <dbee_kawai at yahoo.com>:
> Hello Mapserver experts,
>
> I have question in my mind, How to display Labels from 1 table in my
> database (Postgre + Postgis)?
> in this table there are fields of : name_region, values_1, values_2, How to
> appear them? Could Mapserver make it?
> I ask this question, because I want to show the difference values_1 between
> values_2 in my Bar Chart :)
>
> if i do this (code in the bottom) then just appear values_2 in the map :) ?
>
> LAYER
> STATUS DEFAULT
>     TYPE ANNOTATION
>     CONNECTIONTYPE POSTGIS
>     CONNECTION "user=x password=x dbname=mydb host=host port=5432"
>     DATA "the_geom FROM tb_region USING UNIQUE code_region"
>
>     LABELITEM "name_region"
>         CLASS
>         LABEL
>         COLOR 0 0 0
>         TYPE Truetype
>         FONT Arial
>         SIZE 11
>         MINSIZE 8
>         ANGLE Auto
>         POSITION UC
>         ANTIALIAS True
>         END # LABEL
>     END #CLASS
>
>     LABELITEM "values_1"
>         CLASS
>         LABEL
>         COLOR 255 255 255
>         TYPE Truetype
>         FONT Arial
>         SIZE 9
>         MINSIZE 8
>         ANGLE Auto
>         POSITION UC
>         ANTIALIAS True
>         END # LABEL
>     END #CLASS
>
> LABELITEM "values_2"
>         CLASS
>         LABEL
>         COLOR 255 255 255
>         TYPE Truetype
>         FONT Arial
>         SIZE 9
>         MINSIZE 8
>         ANGLE Auto
>         POSITION UC
>         ANTIALIAS True
>         END # LABEL
>     END #CLASS
> END #LAYER
>
> Thanks really appreciate yours,
>
> -Theresia :)
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Treffen Sie uns auf der INTERGEO
05.10. - 07.10.2010
in Köln Halle: 11.2
Stand-Nr: 2C.121
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----------------------------------------------------------
Michael Schulz
mschulz at webgis.de

in medias res
Gesellschaft für Informationstechnologie mbH

Schwimmbadstraße 2
D-79100  Freiburg i. Br.

Tel:  +49 (0)761 705798-102
Tel:  +49 (0)761 705798-0
Fax: +49 (0)761 705798-09

http://www.webgis.de / http://www.zopecms.de
--------------------------------------------------------------
Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg


More information about the mapserver-users mailing list