[postgis-users] connecting to postgis form mapserver

Ben Madin lists at remoteinformation.com.au
Wed Aug 17 17:44:51 PDT 2011


Vishal,

David has probably nailed this one, but if not or otherwise you might also want to put DEBUG ON into your map and the LAYER definitions (you need both) - the debug output from postgis connections is comprehensive if a little complex initially, but very useful for learning.

It doesn't hurt to explicitly set projections as well, to make sure they match.

cheers

Ben



On 18/08/2011, at 4:09 AM, Vishal Mehta wrote:

> Hi all,
>  
> I am testing out mapserver-postgis and a simple test is returning an empty map. Here is my  map file
>  
> MAP
>   IMAGETYPE   PNG
>   EXTENT 77.5 12.95 77.7 13.01
>   SIZE        550 450
>   IMAGECOLOR  255 255 255
>   SHAPEPATH   "../data"
>     # Start of LAYER DEFINITIONS-------------------------------
>   LAYER
>     CONNECTIONTYPE POSTGIS
>                 NAME "wards"
>     # Connect to a remote spatial database
>                 CONNECTION "host=localhost port=5432 dbname=empty user=postgres password=xxx"
>                   # Get the lines from the 'geom' column of the 'wards' table
>                   DATA 'geom from "myschema.wards198" using srid=4326 using unique gid'
>                   STATUS ON
>                   TYPE POLYGON
>  
>     CLASS
>       NAME "wards"   
>       STYLE
>         OUTLINECOLOR 255 0 0
>       END
>     END
>   END
>    
>   # End of LAYER DEFINITIONS -------------------------------
> END
> -------------------
> And the html that calls it
> --------------
> <html>
> <head>
> <title>my postgis map</title>
> </head>
> <body bgcolor=white>
> <center>
> <br>
> <table width=570>
> <tr>
>    <td>
>      <br>
>      <img width=550 height=450
>      src=/cgi-bin/mapserv.exe?map=C:\OSGeo4W/apps/mapserver-tutorial/mytests/example.map&mode=map
>      border=1>
>    </td>
> </tr>
> </table>
> <br>
> </body>
> </html>
> ----------------------------------------------------
> Other info:
> Platform:
> -          Windows 7, postgresql9 , postgis 2.0
> -          I installed Mapserver separately through the OSGEO4 installer.
> -          I can connect to the same database through php
> -          I can create simple mapserver apps using shapefiles etc alright (e.g. same map file above, calling a shapefile, works fine)
> -          Mapserv.exe –v shows that it was installed with postgis support.
> -          Also can Mapserver handle postgis Mulipolygon geometry ok?
>  
> I did check most of the points here which seemed ok ( i did not check those in this list that I don’t really know how to in Windows ).
> http://trac.osgeo.org/mapserver/wiki/PostGIS
>  
> I realize this might be a mapserver mailing list qn, but thought that some of you might know the answer…it might be a simple syntax problem that I’ve missed…
>  
> Thanks,
> Vishal
>  
>  
>  
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110818/63b0e076/attachment.html>


More information about the postgis-users mailing list