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

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Wed Oct 6 16:07:27 PDT 2010


Michael's post was right on, study his example closely. You TEXT parameter is in the wrong place. There's no need to use a FEATURE object...

Steve
________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] On Behalf Of elisabeth theresia [dbee_kawai at yahoo.com]
Sent: Wednesday, October 06, 2010 10:48 AM
To: mapserv forumlist
Subject: Re: [mapserver-users] How to display Labels from 1 table?

Hi Mr. Michael,

Thanks for replying, i already did what you suggested to me and i delete my layer about LABELITEMS (my coding in the bottom), but there's no labels appear in my map yet, why?

then when i write like this: (coding) there was an error message : getString(): Symbol definition error. Parsing error near ([name_region]|[value_1]-[value_2])

here the coding:
LAYER
    NAME "Annotation of Region"
    TYPE ANNOTATION
    STATUS DEFAULT
    FEATURE
            TEXT ([name_region]|[value_1]-[value_2])
            END #FEATURE
        CLASS
        LABEL
        COLOR 0 0 0
        TYPE Truetype
        FONT Arial
        SIZE 11
        MINSIZE 8
        ANGLE Auto
        POSITION UC
        ANTIALIAS True
        WRAP "|"
        END #LABEL
        END #CLASS
END #LAYER


Thanks for the attention :)
-Theresia

________________________________
rFrom: Michael Schulz <xx at xx.x>
To: elisabeth theresia <xx at xx.com>
Cc: mapserv forumlist <mapserver-users at lists.osgeo.org>
Sent: Wed, October 6, 2010 6:45:30 AM
Subject: Re: [mapserver-users] How to display Labels from 1 table?

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<mailto: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<mailto: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<mailto: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