[GIS] Error when displaying .shp from postgis with mapserver

mapserverpostgis

I have postgis database with lines in .shp format in 3D. I made connection in map file:

     LAYER 
 NAME paths_3D
 CONNECTIONTYPE POSTGIS
 CONNECTION "host=www.*****.com port=5433 dbname=mountain user=**** password=****"
 DATA "the_geom from paths_3D"
 STATUS ON
 TYPE LINE
 CLASS
    NAME "all_paths"
    STYLE
       COLOR 188 143 143
    END
END
END

Then, I added checkbox in html file pointing on that .shp in postgis database:

<input type="checkbox" onClick="UpdateMap()" name="layer" value="paths_3D" [paths_3D_check] > Paths<br/>

So, when I open my web page and click on checkbox named Paths, it gives me this error:

writeLog(): Unable to access file. mslog.log msDrawMap(): Image handling error. Failed to draw layer named 'paths_3D'. msPostGISLayerWhichShapes(): Query error. Error (ERROR: column "oid" does not exist LINE 1: ...ary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"oid" from... ^ ) executing query: select encode(ST_AsBinary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"oid" from paths_3D where the_geom && GeomFromText('POLYGON((561889.240401714 5072468.31385521,561889.240401714 5093238.31385536,589594.131887715 5093238.31385536,589594.131887715 5072468.31385521,561889.240401714 5072468.31385521))',find_srid('','paths_3D','the_geom'))

I don't know what is wrong, please help.

Best Answer

Even better, get a newer version of MapServer that doesn't expect OIDs. And use the "USING UNIQUE" syntax to specify your primary key as the unique identifier.

Related Question