[postgis-users] Querying MapServer PostGIS layer

Stephen Woodbridge woodbri at swoodbridge.com
Thu Apr 13 07:53:44 PDT 2006


Dave,

Shapefile attribute columns are all UPPERCASE and Postgres/postgis 
attribute columns are all lowercase so you need to make sure that the 
reference to the attribute columns in your template match the case 
expected by the data source.

-Steve W

Dave Stone wrote:
> Please excuse if this post has been asked before; I'm new to the list 
> and finding it difficult to locate all the hidden gems of wisdom!
> 
> I'm having a problem with querying a MapServer layer consisting of 
> points stored in a PostGIS table. The plan is simple enough: I'm 
> displaying the dots together with a boundary and an annotation layer, 
> and I want to click on a dot and have a page come up showing non-spatial 
> attributes from the PostGIS record for that location.
> 
> What happens when I click a dot is I get a completely blank page titled 
> 'MapServer Message' (but no message). The relevant bit of the MapServer 
> .map file is:
> 
>   LAYER # query layer using the loccoords PostgreSQL table
>     CONNECTIONTYPE postgis
>     NAME          saint_locations
>     CONNECTION    "user=erdb13 dbname=stdraft"
>     DATA          "geom from loccoords using unique locationref using 
> srid=27700"
>     STATUS        ON
>     DEBUG         ON
>     TYPE          POINT
>     TOLERANCE     25
>     CLASS
>       NAME        "Locations"
>       MINSCALE    2000000
>       TEMPLATE    "result.html"
>       DEBUG       ON
>       STYLE
>         SYMBOL      "circle"
>         SIZE        5
>         COLOR       255 0 0
>         OUTLINECOLOR 0 0 0
>       END
>     END
> 
> This whole idea is based on an example in the MapServer tutorial 
> (http://hypnos.cbs.umn.edu/tutorial/section3.html, choose Ex.3.1). The 
> example works fine, so why doesn't my version?  The answer seems to be 
> that the layer being queried in the example is a shapefile whereas mine 
> is in PostGIS.  To test this suspicion, I amended the layer definition 
> in the .map file as follows:
> 
>   LAYER # query layer using the loccoords PostgreSQL table
> #   CONNECTIONTYPE postgis
>     NAME          saint_locations
> #   CONNECTION    "user=erdb13 dbname=stdraft"
>     DATA          "/var/www/html/saints/data/parish/locs"
>     STATUS        ON
> 
> 'locs' is a shapefile produced by dumping (with pgsql2shp) the 
> 'loccoords' table in the first DATA statement above.
> 
> With only this trivial change, the query template 'result.html' works as 
> intended. But since I want to use the PostGIS functionality, I need to 
> find out what's wrong with the first LAYER spec. above.
> 
> Any suggestions most gratefully received,
> 
> Dave
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list