PostGIS multiple table query

Edward Nuttall ewnuttall at QINETIQ.COM
Tue Oct 25 08:11:55 PDT 2005


Dear all,

I am trying to get a PostGIS Layer working, the following layer works fine:


      LAYER
             NAME "my_layer"
             TYPE POINT
             STATUS ON
             CONNECTIONTYPE POSTGIS
             CONNECTION "dbname=my_db user=me host=localhost port=5432"

             DATA "location from (select cars.location, cars.date from
cars) as myquery using unique location using srid = -1"

              TEMPLATE "/home/qgis/mariss/image_info.html"

              CLASS
                     NAME "My Layer"
                     OUTLINECOLOR 0 0 0
                     COLOR 220 220 0
                     SIZE 7
                     SYMBOL "circle"
              END
              PROJECTION
                     "+proj=latlong"
              END

              METADATA
                     WMS_TIMEEXTENT "2005-02-05/2009-10-01"
                     WMS_TIMEITEM "date"
              END

     END


However, when I extend the Query to included another table, as shown below:


      LAYER
             NAME "my_layer"
             TYPE POINT
             STATUS ON
             CONNECTIONTYPE POSTGIS
             CONNECTION "dbname=my_db user=me host=localhost port=5432"

             DATA "location from (select cars.location, cars.date from
cars, users where cars.id = users.id) as myquery using unique location
using srid = -1"

             TEMPLATE "/home/qgis/mariss/image_info.html"

             CLASS
                     NAME "My Layer"
                     OUTLINECOLOR 0 0 0
                     COLOR 220 220 0
                     SIZE 7
                     SYMBOL "circle"
             END

             PROJECTION
                     "+proj=latlong"
             END

             METADATA
                     WMS_TIMEEXTENT "2005-02-05/2009-10-01"
                     WMS_TIMEITEM "date"
             END

     END



I get the following error:

"Postgresql reports the error as 'ERROR: find_srid() - couldnt find the
corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS
table?"

All geometry columns in all the tables are 'working' as layers in the
mapfile and have been registered in the GEOMETRY_COLUMNS table, also the
select query does return a result set. I can see there is some SRID error,
and this is where I get confused, when I've added my geometry columns I
have always used -1, indeed anywhere SRID pops up I have just used -1.

Any help would be much appreciated,

Thanks
Ed



More information about the MapServer-users mailing list