[postgis-users] Dilemma: is gid really useful in a geoDB?

Markus Schaber schabi at logix-tt.com
Wed Feb 21 10:15:27 PST 2007


Hi, Antonello,

Antonello <antonello.monetsen at gmail.com> wrote:

> I have a dilemma: is gid really useful in a geoDB?
> I am building a geodb for several harbor. When I create a layer(table 
> with geometry) in postgis, I need a gid like a primary key, or I can use 
> a different one? Can I  use several field of from the table like a 
> primary key?
> I am not new in the gis, but why in almost all geoDB I saw there is a 
> gid?! Is it really necessary? Do it come from shapefile standards?

Technically, there's no need for a gid, from the database point of
view, as SQL deals with sets of rows.

However, most applications want some way of identifying specific rows,
especially when updating / editing data.

GID is generated by shp2pgsql.

> For example QuantumGIS doesn't work if the layer has only one primary 
> key, there are other application that don't work like qGis?

QuantumGIS has the additional oddity that the primary key has to be of
type int4 - int8 or serial (which is optimal for primary keys) is not
accepted, AFAIK.

For read-only access, you can try MezoGIS which makes very little
assumptions about your database, and you can specify layers via
arbitrary queries.


Regards,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



More information about the postgis-users mailing list