MapServer PostGIS connection: oids an gids to build a query

Gregor Mosheh gregor at HOSTGIS.COM
Wed May 23 08:50:32 PDT 2007


> I have imported some geographical data (POINT) and their alphanumeric information in 
> PostgreSQL\PostGIS database. The structure of the database is WITHOUT OIDS and there 
> are no GIDs in the tables. So PK and FK are not numerical keys: they are string type keys!.

Ouch! Mapserver does use the oid, and having an index on the oid is very 
helpful for performance. (this was the case with 4.8 anyway, has it 
changed in 4.10?)


> So MapServer is able only to query data if they have integer ids in 
> PostGIS structure. WHY ??

Mapserver/PostGIS queries by coordinate. "select where the_geom 
intersects" blah blah blah. I don't know about the other GIS software, 
but a unique identifier field, a primary key, is a pretty standard 
expectation.

I'd say to always have numeric fields for both PKs and FKs, but that's 
just me talking on general principle.

-- 
Gregor Mosheh / Greg Allensworth
System Administrator, HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA



More information about the MapServer-users mailing list