[mapserver-users] Trouble connecting to PostGIS

Bistrais, Bob Bob.Bistrais at maine.gov
Mon Feb 13 13:35:19 PST 2012


Thanks Brent.  The postgis user SHOULD have access to the table, as that
is the table's owner.  Coordinate system is in the map file under
Projection.

 

Here is what the debug log showed me (Metwp100Poly is the actual name of
the table, and MAINE is the layer name):

 

[Mon Feb 13 16:31:32 2012].453000 CGI Request 1 on process 1300

[Mon Feb 13 16:31:32 2012].687000 msPOSTGISLayerRetrievePGVersion():
Query error. Error executing POSTGIS statement
(msPOSTGISLayerRetrievePGVersion():select substring(version() from 12
for (position('on' in version()) - 13))

[Mon Feb 13 16:31:32 2012].687000 prepare_database(): Query error. Error
declaring cursor: ERROR:  relation "metwp100poly" does not exist

LINE 1: ...lection(force_2d(the_geom)),'NDR'),OID::text from
Metwp100Po...

                                                             ^

 

With query string: DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from
Metwp100Poly WHERE the_geom && setSRID('BOX3D(134000
4692598.18523154,890900 5307401.81476846)'::BOX3D,
find_srid('','Metwp100Poly','the_geom') )

 

[Mon Feb 13 16:31:32 2012].687000 msDrawMap(): Image handling error.
Failed to draw layer named 'MAINE'.

[Mon Feb 13 16:31:32 2012].687000 msFreeMap(): freeing map at 015258C8.

 

________________________________

From: Brent Fraser [mailto:bfraser at geoanalytic.com] 
Sent: Monday, February 13, 2012 4:25 PM
To: Bistrais, Bob
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Trouble connecting to PostGIS

 

Bob,
  Typical problems are 
        - the connecting user (postgisuser) does not have privilege to
access the table
        - coordinate system is not specified in data (SRID=-1) and not
in the mapfile either
        -  and others

Turn on the layer debug logging by adding 

DEBUG 5

to your mapfile and looking a the log.  You can also execute the SQL
statements shown in the log file using pgAdmin's SQL tool to see
additional information.
  



Best Regards,
Brent Fraser


On 2/13/2012 2:11 PM, Bistrais, Bob wrote: 

First of all, let me state that I am brand new to PostGIS and don't know
much about what I'm doing with it.  That being said, I am having trouble
displaying a PostGIS layer through MapServer.

 

Right now I'm just experimenting with PostGIS and simply trying to get a
layer to display.  I installed the Postgre and PostGIS 1.5.  I used the
shapefile loader to convert a couple shapefiles to PostGIS data.
Looking in pgAdmin, I see the tables do indeed exist for these layers.

 

So I built a MapServer map file.  Here is my connection strings:

 

DATA "the_geom from MylayerPoly"

CONNECTION "user=postgisuser password=MyPassword! dbname=postgistest
host=localhost port=5432"

CONNECTIONTYPE postgis

 

But the layer does not display.  Incidentally, I'm using GeoMoose as a
front end for testing, but that shouldn't matter here.

 

I did a mapserv -v at commandline, and I see the parameter
INPUT=POSTGIS.

 

So as far as I know it should work. Can anyone offer suggestions as to
what I'm doing wrong?

 

Thanks,

Bob






_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120213/954a8341/attachment-0001.html


More information about the mapserver-users mailing list