If you imported the spatial layer with shp2pgsql or OGR programs, their should be a unique id field already (e.g. 'gid' with shp2pgsql). You can tell MapServer to use this unique id field instead of oid in the LAYER -> DATA variable of your MapFile.

Example:
     DATA "the_geom FROM roads AS foo USING UNIQUE gid"

Aaron


On 6/22/06, Nigel Gilbert < [EMAIL PROTECTED]> wrote:
I am trying to use mapserver with a PostGIS enabled database.  However, I
get the mapserver error:

prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual
query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(geom)),'XDR'),OID::text from world WHERE
geom && setSRID('BOX3D(-1333.33333333333 -1000,1333.33333333333
1000)'::BOX3D, find_srid('','world','geom') )'

Postgresql reports the error as 'ERROR: column "oid" does not exist '

I then noticed that the documentation for PostGIS, section 4.7.1 says that I
should create an oid index for the table I am wanting to display.  So,
following the suggestion there, I tried, in the psql monitor:

create index world_oid_index on world ( oid );
ERROR:  column "oid" does not exist

where 'world' is the table containing my geometry column.  I haven't found
anything useful to help in either the PostGIS documenation or the PostgreSQL
docs.

What am I doing wrong?

Many thanks for your help!


--
Nigel



--
+--------------------------------------------
|  Aaron Koning
|  Information Technologist
|  Prince George, BC, Canada.
+--------------------------------------------
|  http://datashare.gis.unbc.ca/fist/
|  http://datashare.gis.unbc.ca/gctp-js/
+--------------------------------------------

Reply via email to