[MS4W-Users] mapserver not displaying postgis layers

Jeff McKenna jmckenna at gatewaygeomatics.com
Sat May 15 13:49:25 EST 2010


Linnet Kwamboka wrote:
> hey guys,
> i have trouble displaying postgis layers on mapserver nothing at all 
> seems to work, any idea how i can change this, coz when i load directly 
> from  a shapefile, everything is ok, but not postgis, here is the code
> 
>  LAYER
>     NAME 'kenya_administrative'
>     TYPE LINE
>     CONNECTIONTYPE postgis
>     CONNECTION "dbname='postgis-try' host=localhost port=5432 
> user='postgres' password='postgres'"
>     DATA "the_geom FROM kenya_administrative"
>     METADATA
>       'wms_title' 'kenya_administrative'
>     END
>     STATUS OFF #when status in ON, its completely blank when off there 
> is a gray background
>     TRANSPARENCY 100
>     PROJECTION
>     "init=epsg:31468"
> 
>     END
>     CLASS
>        NAME 'kenya_administrative'
>        STYLE
>          SYMBOL 0
>          SIZE 2
>          OUTLINECOLOR 150 123 90
>          COLOR 0 0 0
>        END
>     END
>   END
> 

Linnet,

I recommend that you:

- remove all other layers from your mapfile, so that there is only one 
layer (postgis layer)
- remove all projection objects from your mapfile
- use the ogrinfo command to get the extent of your postgis layer (see 
the example in http://www.mapserver.org/input/vector/postgis.html)
   - use the extents returned from ogrinfo in your EXTENT parameter of 
your mapfile
- retry using shp2img

That should display your postgis layer.  If you make it that far, then 
you can worry about projection issues.

-jeff


---
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




More information about the MS4W-Users mailing list