[mapserver-users] Geom Field with PostGIS

B. Heath Robinson heath at midnighthour.org
Wed Jun 1 12:57:12 EDT 2011


I am using tilecache with mapserver to serve map tiles.  I seem to be having a problem because my geometry column is not named 'geom'.  Below is my mapfile exerpt and the error message.  You can see the the SQL that is built is not correct.  I did some digging in the source code and found the lines I think are the culprit.  I have also included these below.


Mapfile Exerpt
    CONNECTIONTYPE postgis
    CONNECTION "dbname='gisdb' host='localhost' port=5432 user='webuser' password='*********' sslmode=disable"
    DATA 'shape FROM "maps_parcel" USING UNIQUE id USING srid=4326'


ERROR
An error occurred: msDrawMap(): Image handling error. Failed to draw layer named 'parcels'.
msPostGISLayerWhichShapes(): Query error. Error (ERROR:  column "shape" does not exist
LINE 1: ..."color",encode(AsBinary(force_collection(force_2d("shape")),...
                                                             ^
) executing query: select "id","color",encode(AsBinary(force_collection(force_2d("shape")),'NDR'),'hex') as geom,"id" from "maps_parcel" where shape && GeomFromText('POLYGON((-97.4212539097114 31.0482371048694,-97.4212539097114 31.0529247835391,-97.4157822026614 31.0529247835391,-97.4157822026614 31.0482371048694,-97.4212539097114 31.0482371048694))',4326)
  File "/srv/ve/two-release/lib/python2.6/site-packages/TileCache/Service.py", line 303, in wsgiHandler
    format, image = service.dispatchRequest( fields, path_info, req_method, host )
  File "/srv/ve/two-release/lib/python2.6/site-packages/TileCache/Service.py", line 208, in dispatchRequest
    return self.renderTile(tile, params.has_key('FORCE'))
  File "/srv/ve/two-release/lib/python2.6/site-packages/TileCache/Service.py", line 138, in renderTile
    data = layer.render(tile, force=force)
  File "/srv/ve/two-release/lib/python2.6/site-packages/TileCache/Layer.py", line 444, in render
    return self.renderTile(tile)
  File "/srv/ve/two-release/lib/python2.6/site-packages/TileCache/Layers/MapServer.py", line 51, in renderTile
    mapImage = wms.draw()
  File "/srv/ve/two-release/lib/python2.6/site-packages/mapscript.py", line 1466, in draw
    def draw(*args): return _mapscript.mapObj_draw(*args)

Links are to trac source code
1612 - from msPostGISBuildSQLItems
It aliases all geom columns to 'geom'



1861 -  from msPostGISBuildSQLWhere
It builds the BBOX part of the where clause with the geom column from the config file



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110601/43052bb5/attachment.html


More information about the mapserver-users mailing list