[GRASS-user] Associating attributes from Postgres file with a
key other than cat
Turner, James
James.Turner at kronos.com
Thu Aug 9 12:46:13 EDT 2007
The problem is that the e00 file isn't in the Postgres database.
Basically, I imported the e00 file into dbf "normally" using the gui,
then tried to attach the Postgres table as attributes of the data from
the e00 file I imported. But because the key field from the e00 file
(cat) doesn't exist in the Postgres table, I can't associate the data
based on the field they do share in common (zipcode).
I suppose I could have imported the e00 into Postgres, instead of dbf,
in which case the strategy you describe would work.
James M. Turner
Senior Software Engineer - Kronos Labs
Kronos, Inc.
2 Omni Way, Chelmsford, MA 01824
(w) 978-947-4108, (c) 603-552-2020, (f) 978-256-2477
jamesturner at kronos.com
> -----Original Message-----
> From: Jarek Jasiewicz [mailto:jarekj at amu.edu.pl]
> Sent: Thursday, August 09, 2007 11:55 AM
> To: Turner, James
> Cc: Daniel Victoria; grassuser at grass.itc.it
> Subject: Re: [GRASS-user] Associating attributes from Postgres file
with a
> key other than cat
>
> Turner, James wrote:
> > That would work if there was an equivalent to the CAT field in the
table
> > I wanted to join to. There isn't, it needs to join on the zip code,
> > which is the key field for the data in Postgres. There doesn't seem
to
> > be any way to associate data from an SQL table to a piece of vector
data
> > unless the SQL table has the same cat field available. In other
words,
> > if the original imported e00 file has:
> >
> > cat
> > zipcode
> > altitude
> > population
> >
> > and the database table has:
> >
> > zipcode
> > median_income
> > life_expectancy
> >
> >
>
> I have a problem with understanding what you really want, because I
see
> no relation between imported e00 and database (there are from one
source
> or not, I don't know if database of e00 is in pgSQL or in other pale
> etc) but, if you have in one database two tables: let say: e00 and
ZTCS
> with structure similar to above mayby this will help:
>
> CREATE TABLE joined AS
> SELECT e.cat AS cat, e.zipcode AS zipcode, e.population AS population
> z.medianincome AS medianincome, z.life_xepectancy AS life_expentancy
> FROM ZTCS z JOIN e00 e ON z.zipcode=e.zipcode;
>
> next join jour importet e00 file to new table with v.db.conect
>
More information about the grass-user
mailing list