How to display Labels from 1 table?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to display Labels from 1 table?

dbee_kawai
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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: How to display Labels from 1 table?

Michael Schulz
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 <[hidden email]>:

> 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
> [hidden email]
> 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
[hidden email]

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
_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: How to display Labels from 1 table?

dbee_kawai
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 <[hidden email]>
To: elisabeth theresia <[hidden email]>
Cc: mapserv forumlist <[hidden email]>
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 <[hidden email]>:

> 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
> [hidden email]
> 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
[hidden email]

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


_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

RE: How to display Labels from 1 table?

Lime, Steve D (MNIT)
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: [hidden email] [[hidden email]] On Behalf Of elisabeth theresia [[hidden email]]
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 <[hidden email]>
To: elisabeth theresia <[hidden email]>
Cc: mapserv forumlist <[hidden email]>
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 <[hidden email]<mailto:[hidden email]>>:

> 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
> [hidden email]<mailto:[hidden email]>
> 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
[hidden email]<mailto:[hidden email]>

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


_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: How to display Labels from 1 table?

dbee_kawai
Horray Mr. Michael and Mr. Lime thanks it works. really appreciate your kindness :)

best regards,

-Theresia



From: "Lime, Steve D (DNR)" <[hidden email]>
To: elisabeth theresia <[hidden email]>; mapserv forumlist <[hidden email]>
Sent: Wed, October 6, 2010 4:07:27 PM
Subject: RE: [mapserver-users] How to display Labels from 1 table?

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: [hidden email] [[hidden email]] On Behalf Of elisabeth theresia [[hidden email]]
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 <[hidden email]>
To: elisabeth theresia <[hidden email]>
Cc: mapserv forumlist <[hidden email]>
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 <[hidden email]<mailto:[hidden email]>>:

> 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
> [hidden email]<mailto:[hidden email]>
> 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
[hidden email]<mailto:[hidden email]>

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




_______________________________________________
mapserver-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapserver-users