[Mapserver-users] How to make labels in MS with PostGIS

christian.schuster at rsag.ch christian.schuster at rsag.ch
Mon Feb 3 21:03:05 PST 2003




Hi Paul,

Sorry that I am coming back to you after few days. I am still not able to
make labels. I am a newbie and I think it is a generall understanding
problem of how the map file works. Below you see my layer definitions for
the labels. There I have a big question about it. So I have a table called
'geo3'. In this table I have a column as identifier which is called 'ID'.
Then the second column is of type varcahr(20 and called 'NAME'. The last
one is the geometry column. Now I can draw the map and all. Just the labels
are not working. I am not sure what the tag 'DATA' has to look like. The
way it is now, I just get back the geometry column. But what I would like
is to have the column 'NAME' to use for labeling. If I change the tag
'DATA' to "NAME from geo3" then I would have this. But I do not know how
MapServer knows where to draw the labels. If I change the tag 'DATA' to "*
from geo" then I get an error. So I am quite confused. I also tried so many
times already. if someone could solve my confusion would be really nice.

LAYER
  NAME "labels"

  ### Connect to a remote spatial database
  CONNECTIONTYPE postgis
  CONNECTION "user=*** dbname=myGISdb host=127.0.0.1 port=5432"

  ### Get the labels from the table
  DATA "geom from geo3"
  STATUS ON
  TYPE ANNOTATION

  LABELITEM "name"

  CLASS
    EXPRESSION 'name'
    COLOR -1 -1 -1
    LABEL
      COLOR 0 0 0
      TYPE BITMAP
      SIZE MEDIUM
      POSITION CC
      PARTIALS FALSE
      BUFFER 2
    END # end of label
  END
END

Christian Schuster

Rudolf Schuster AG
Postfach 277
CH - 3000 Bern 11

http://www.rsag.ch
++41 31 348 05 30


                                                                           
             Paul Ramsey                                                   
             <pramsey at refracti                                             
             ons.net>                                                   To 
                                       christian.schuster at rsag.ch          
             31.01.2003 17:18                                           cc 
                                       mapserver-users at lists.gis.umn.edu   
                                                                   Subject 
                                       Re: [Mapserver-users] How to make   
                                       labels in MS with PostGIS           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Same as with any other data source. Declare a labelitem and add a label
object to your class object. Should be examples in the map file
reference page. The only potential gotcha is that your labelitem
attribute should be given in lower case.

christian.schuster at rsag.ch wrote:
>
> Hi list,
>
> I have a table 'geo' with a geometry column, a column 'name' as
> varchar(20) and an ID column as the Primary Key. Is it possible to use
> the text in the column 'name' as the label text and if so what does the
> layer look like in the map file.
>
> Thanaks for helping
>
> Christian Schuster
>
> Rudolf Schuster AG
> Postfach 277
> CH - 3000 Bern 11
>
> http://www.rsag.ch
> ++41 31 348 05 30

--
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_





More information about the MapServer-users mailing list