Thanks Aaron, I choose option number 2 and included a JOIN statement like this:

DATA "posicion from (select loca.cmpoid, loca.mo, loca.posicion, autos.placas as placa from loca inner join autos on loca.idunit = autos.idunit where %uad%) as foo using unique cmpoid using srid=4326"

the %uad% is for filtering purposes.

works OK
 
Regards,
Luis
----- Original Message -----
Sent: Monday, June 19, 2006 3:24 PM
Subject: Re: [UMN_MAPSERVER-USERS] How can I label a Point using different postgis table

I believe you have two options here:

1. Create a database view that joins the two tables and set your DATA variable to that view.
          OR
2. Modify the DATA variable to include a JOIN statement.

Aaron

On 6/19/06, Luis Treviño Huerta <[EMAIL PROTECTED]> wrote:
Hi list:

I'm currenttly using a point layer that displays some GPS points that are
stored on a postgis table called "loca". I'd like to label this points with
data that comes from another table in the same postgis data base (this table
is named "autos"), both tables share a common column named "idunit" and I
would like to use autos.idunit as a label. How can I do this?. This is part
of my map file:

LAYER
   NAME gis
   STATUS ON
   TYPE POINT
   UNITS METERS

   DEBUG ON
   CONNECTION "user=XXX password=XXXXX dbname=bsiubica host=XXX.XXX.XXX.XX
port=5432"
   CONNECTIONTYPE postgis
   DATA "posicion from loca as foo using unique cmpoid using srid=4326"

   PROJECTION
      "proj=longlat"
      "ellps=WGS84"
     "datum=WGS84"
   END

  FILTER 'idunit = %unid%'

   CLASS
     _expression_ ('[mo]' = '1')
     COLOR 255 255 26  #amarillo
     SYMBOL 7
     SIZE 13
   END
END

regards,
Luis



--
+--------------------------------------------
|  Aaron Koning
|  Information Technologist
|  Prince George, BC, Canada.
+--------------------------------------------
|  http://datashare.gis.unbc.ca/fist/
|   http://datashare.gis.unbc.ca/gctp-js/
+--------------------------------------------

Reply via email to