[Mapserver-users] Error when querying PostGIS layer
Mark Cave-Ayland
m.cave-ayland at webbased.co.uk
Fri Jan 16 03:24:35 PST 2004
Hi Dylan,
Sometimes working with PostGIS/Mapserver I find that error messages
don't always make it through to Mapserver. A good trick is to copy the
query from the select without the cursor declaration, paste it into a
psql session, and you should then see the exact error message being
generated by PostgreSQL.
For example, in your case, type the following in psql and see if it
gives a more verbose error message:
SELECT nf1::text,asbinary(force_collection(force_2d(the_geom)),'NDR')
,OID::text
from quad24k WHERE the_geom && setSRID('BOX3D(311625 301705,586625
577205)'::BOX3D, find_srid('','quad24k','the_geom') )
Cheers,
Mark.
---
Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England
Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.
> -----Original Message-----
> From: mapserver-users-admin at lists.gis.umn.edu
> [mailto:mapserver-users-admin at lists.gis.umn.edu] On Behalf Of
> Dylan Keon
> Sent: 15 January 2004 20:01
> To: mapserver-users at lists.gis.umn.edu
> Subject: Re: [Mapserver-users] Error when querying PostGIS layer
>
>
> I'd be really grateful if some of you postgis/postgres gurus
> could give
> me a hand with this (see question below) - it's got me
> stumped. Jason
> Nielsen posted a similar question a little while ago.
>
> I've already tried GRANT SELECT ON quad24k TO PUBLIC; and
> verified that
> the asbinary SELECT statement following 'DECLARE mycursor
> BINARY CURSOR
> FOR' works in psql.
>
> TIA for any help. I pasted some more info at the bottom of
> the message.
>
> --Dylan
>
>
> Dylan Keon wrote:
> > I'm having trouble querying a PostGIS layer via PHP Mapscript. The
> > layer renders fine in the app and labels get generated,
> etc. But I get
> > an error when trying to query the layer. It fails when it reaches
> > getShape() - if I comment out that line everything else
> works. Also, if
> > I run this code on a shapefile version of the same layer it
> works fine.
> >
> > I'm using MS 4.0.1, Postgres 7.4.1, PostGIS 0.8.1 on Linux. Thanks
> > for
> > any help.
> >
> > --Dylan
> >
> >
> ----------------------------------------------------------------------
> >
> > From the apache error log:
> >
> > PHP Warning: [MapServer Error]: msDrawMap(): Failed to draw layer
> > named 'quad_index_24k'. in /opt/httpd/htdocs/test.php on line 132
> > PHP Warning: [MapServer Error]: prep_DB(): Error executing POSTGIS
> > DECLARE (the actual query) statement: 'DECLARE mycursor
> BINARY CURSOR
> > FOR SELECT
> >
> nf1::text,asbinary(force_collection(force_2d(the_geom)),'NDR')
> ,OID::text
> > from quad24k WHERE the_geom && setSRID('BOX3D(311625 301705,586625
> > 577205)'::BOX3D, find_srid('','quad24k','the_geom') )' <br><br>
> >
> > Postgresql reports the error ''<br><br>
> >
> > More Help:<br><br>
> >
> > Error with POSTGIS data variable. You specified '<check your .map
> > file>'.<br>
> > Standard ways of specifiying are : <br>
> > (1) 'geometry_column from geometry_table' <br>
> > (2) 'geometry_column from (<sub query>) as foo using unique
> > <column name> using SRID=<srid#>' <br><br>
> >
> > Make sure you put in the 'using unique <column name>' and
> > 'using SRID=#' clauses in.
> >
> > <br><br>For more help, please see
> > http://postgis.refractions.net/documentation.php
> >
> > <br><br>Mappostgis.c - version of June 12/2003.
> >
> > in /opt/httpd/htdocs/test.php on line 132
> > PHP Fatal error: Call to a member function on a non-object in
> > /opt/httpd/htdocs/test.php on line 133
> >
> >
More information about the MapServer-users
mailing list