[postgis-users] connecting to postgis form mapserver

David Fawcett david.fawcett at gmail.com
Wed Aug 17 14:15:29 PDT 2011


You will either need to add the layer name explicitly in the request URL, or set the layer status to DEFAULT.

David



On Aug 17, 2011, at 3:09 PM, Vishal Mehta <vishal.mehta at sei-us.org> 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/20110817/995c3d98/attachment.html>


More information about the postgis-users mailing list