Problem diplaying PostGIS layer. Postgres and Mapserver have been setup on separate Machines

Bill Binko bill at BINKO.NET
Wed Apr 20 15:20:40 EDT 2005


I believe your problem is in your DATA line.

LAYER
NAME "qru_fnl1"
CONNECTIONTYPE postgis
CONNECTION "user=root password=c3n5u5 dbname=census host=localhost"
DATA "the_geom from qry1 using srid=-1"
...

I assume that qry1 is a view, but you're mixing the two formats for
PostGIS's DATA line.  You can either do:

DATA "the_geom from table" (and it must really be a table)

or

DATA "the_geom from (select uniqueId, the_geom from qry1) as subQ using
unique uniqueId using srid=-1"

The reason's simple, but not really well documented.  Mapserver needs the
following to draw:

1) the shape's column
2) the srid
3) a unique ID for the shape

If you use the simple table format, it can use the oid of the table as the
unique id, and lookup the srid from the OGC standard geometry_columns
metadata table.

If you use a view, you need to specify the uniqueID and the srid, because
the view doesn't have an oid (unless you pull it from another table) and
isn't listed in the geometry_columns table.

Hope this helps

Bill



More information about the mapserver-users mailing list