[Mapserver-users] PostGIS blank error - bit of a newbie question....!

Matt Hatcher matt at phyreworks.com
Tue Apr 13 08:25:03 EDT 2004


Hi,

I'm trying to get a postgres connection working with Mapserver 4.0.1 on
Mandrake 9.2. I'm using the Postgres and Postgis RPMs from the postgis
site, and the stable 4.0.1 source compiled with the postgis option. My -v
gives:

MapServer version 4.0.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF
SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT INPUT=JPEG INPUT=POSTGIS INPUT=OGR
INPUT=GDAL INPUT=SHAPEFILE


I've got a table that I loaded from a point shapefile using shp2pgsql
which I can query quite happily from the psql command line. The data in
there is in SRID 4326, e.g.:

 gid | id |     x     |     y     | height_m |  height_ft  | type  |
name    |               the_geom
-----+----+-----------+-----------+----------+-------------+-------+-----------+--------------------------------------
    |  1 | -5.003492 | 56.796264 | 1343.798 | 4408.786096 | Munro | Ben
Nevis | SRID=4326;POINT(-5.003492 56.796264)


When I try and get the data through Mapserver I get the following
unhelpful "blank" error message:

msDrawMap(): Image handling error. Failed to draw layer named 'peaks'. 
prep_DB(): Query error. Error executing POSTGIS DECLARE (the actual query)
statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from
mountains WHERE the_geom && setSRID('BOX3D(-10.5612147941099
48.9367546675052,6.81724902590237 55.7611851275149)'::BOX3D,
find_srid('','mountains','the_geom') )'

Postgresql reports the error ''

More Help:

Error with POSTGIS data variable. You specified '<check your .map file>'.
Standard ways of specifiying are :
(1) 'geometry_column from geometry_table'
(2) 'geometry_column from (<sub query>) as foo using unique <column name>
using SRID=<srid#>'

Make sure you put in the 'using unique <column name>' and 'using SRID=#'
clauses in.

For more help, please see http://postgis.refractions.net/documentation.php


Mappostgis.c - version of June 12/2003.


My map file has:

LAYER
  NAME "peaks"
  TYPE POINT
  STATUS OFF
  CONNECTIONTYPE POSTGIS
  CONNECTION "user=apache dbname=geo"
  DATA "the_geom from mountains"

  PROJECTION
    "init=epsg:4326"
  END

  CLASS
    SYMBOL 'circle'
    SIZE 4
    COLOR   0
  END
END


Any suggestions would be gratefully received!

Cheers, Matt.




More information about the mapserver-users mailing list