QUERYMAP and postgis

Bart van den Eijnden (OSGIS) bartvde at XS4ALL.NL
Wed Jan 18 13:20:55 EST 2006


Peter,

I would never suggest using the geometry column as the unique column. 
The default used is oid, but as you might know as of PostgreSQL 8.1 this 
is not created anymore automatically. Older PostgreSQL versions do have 
it standard, so just leave out your USING UNIQUE in that case from the 
DATA statement. Is there not a primary key on your table which you can 
use otherwise instead of the geometry column?

I would suggest getting some debug information out of Mapserver using 
the practices described here:

http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?DebuggingMapserver

or just log the queries which Mapserver sends at the PostgreSQL level 
(PostgreSQL logging).

In order to solve this, tt might help also providing some version info 
(which Mapserver version, which PostgreSQL version, which PostGIS 
version etc.).

Best regards,
Bart

Peter Huis in 't Veld wrote:

> Hello
>
> I've the question: How can I show the attributes of a a postgis query 
> using mapserver. At the moment I've GIS layer showing me all the 
> object in the spatial database, so the query isn't isn't the problem. 
> Changing the mode into query mode Ik get the following message:
>
> msQueryByPoint(): Search returned no results. No matching record(s) 
> found.
>
> I've seen the remark on the mapserver web-site by Bart vd Eijnden, but 
> this doesn't give me any additional info. I made the following changes
> to the code in order to query the Map file by clicking on the map item:
>
> *QUERYMAP
>   STATUS ON
>   STYLE HILITE
>   COLOR 0 255 0
> END
> *
>
> LAYER
>    CONNECTIONTYPE POSTGIS
>    CONNECTION  ....
>    DATA "object_geom  from  (SELECT a, b, c, object_geom  from table) 
> as myquery using unique object_geom"
>    *TOLERANCE 5*
>    CLASS
>        LABEL
>           ...
>        END             END
>  *  TEMPLATE "query_result.html"*
>    PROJECTION
>             ......
>    END
> END
>
> The query_result.html looks like:
>
>  <table>
>     <tr>
>       <td>[lrn]</td>
>       <td>[a]</td>
>       <td>[b]</td>
>       <td>[c]</td>
>     </tr>
>  </table>
>
> Should the query_result.html be in a specific directory? I've places 
> it in htdocs where my index.html is present.
>
> Thanks for any help!
>
> Peter
>
>


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl



More information about the mapserver-users mailing list