Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.