Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

 NAME paths_3D
 CONNECTION "host=www.*****.com port=5433 dbname=mountain user=**** password=****"
 DATA "the_geom from paths_3D"
    NAME "all_paths"
       COLOR 188 143 143

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.

share|improve this question
up vote 3 down vote accepted

You should precise that you want to create a table WITH OID when you create your table (import from shapefile). See that thread for more precision.

You can also modify your configuration file to create table with OID by default. See the doc.

share|improve this answer
Yes, solution is to write "WITH ( OIDS=TRUE );" when creating table. Thank you :) – againstflow Jun 11 '11 at 13:19

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.