[Mapserver-users] Error with MapServer and PostGIS in Query
Jason M. Nielsen
jnielsen at aero-graphics.com
Tue Jan 20 11:45:24 PST 2004
Quoting rsanabria at prosis.com:
> Hi,
>
> I'm trying to execute a spatial query with MapServer on PostGIS and I
> received
> the following error message:
>
>
> Content-type: text/html msPOSTGISLayerGetShape(): Query error. Error
> executing
> POSTGIS SQL statement (in FETCH ALL): EXPLAIN VERBOSE SELECT * FROM nfs -
> Error
> with POSTGIS data variable. You specified ''.
> 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 Nov 15/2002.
>
> I read the postgis documentation and I tried to create the indexes for the
> table
> but it didn't work, I created the indexes the following way:
>
> CREATE INDEX inx_nfs ON nfs ( oid );
> CREATE INDEX GIST_inx_nfs ON nfs USING GIST (the_geom GIST_GEOMETRY_OPS );
>
> where nfs is our table.
>
> The definition of the layer in the map file is:
>
> LAYER # States polygon layer begins here
> NAME nfs
> CONNECTIONTYPE postgis
> CONNECTION "user=xxxx dbname=xxxxx"
> DATA "the_geom from nfs"
> STATUS OFF
> TYPE POLYGON
>
> CLASS
> COLOR 255 0 0
> OUTLINECOLOR 0 0 0
> NAME "Ninos Fuera del Sistema"
> TEMPLATE "nfs.html"
> END
>
> HEADER "nfs_header.html"
> FOOTER "nfs_footer.html"
>
> TOLERANCE 3
>
> DUMP TRUE
>
> END
>
>
> Some idea?
>
> Thanks a lot!
>
> Ricardo
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
Assuming you are on a *nix system. Does your user "xxxx" exist as a real user on
the system as well as in the database? Also does this user have the proper
privledges to the database you are using? I had this exact same issue and it was
because of that. For a real quick test you can just try using the admin users
Postgresql is using (ie: postgres). Obviously do NOT leave it this way though
but it will instantly tell you if thats the problem. If that is the issue there
is a post in the mailing list on methods to make it work. 1) Make the user
locally. 2)Use the pg_ident.conf etc to setup the user. Method 2 is the
recommended method.
The indexes as far as I know are simply to speed things up but are not required.
-jason
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
More information about the MapServer-users
mailing list