[postgis-users] Creating an ID field in a view

Greg Robillard greg at ecotrust.org
Thu Mar 29 14:59:49 PDT 2007


Perhaps I'm missing something, but in traditional database-speak a view
is just a read-only version of a table, and a spatial view should be the
same. So if your base table has a unique, nonrepeating ID field, if you
include it in the syntax that creates your view it should be correctly
propagated. 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Jose
Gomez-Dans
Sent: Thursday, March 29, 2007 2:50 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Creating an ID field in a view


Hi Steve,

On 3/29/07, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
> It sounds like you need a persistent value. In this case you have to
> probably add a column to one of your existing tables and expose it in
> your view. How else will you be able to uniquely identify a row of
data?

This is true, and I have that column. The problem is that when I do a
GeometryUnion, the column has doubles which appear several times (each
feature is split by the second layer in the union), so the value is no
longer unique. While I want to keep the reference to the original
feature, the new "index" still needs to be different. A way I see is
to add a field to the view that identifies the "row number" (like the
SERIAL fields. But these are for tables not views right?).

Thanks!
Jose
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list