[GRASS-user] Associating attributes from Postgres file with a key other than cat

Turner, James James.Turner at kronos.com
Thu Aug 9 10:24:59 EDT 2007


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

There's no way to get the two associated on the basis of the common
zipcode field.  The only solution I was able to find was to db.copy the
e00 data to the Postgres database, add a cat field to the existing
table, and then use a query to fill the cat fields in by doing a join.

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: Daniel Victoria [mailto:daniel.victoria at gmail.com]
> Sent: Wednesday, August 08, 2007 5:17 PM
> To: Turner, James
> Cc: grassuser at grass.itc.it
> Subject: Re: [GRASS-user] Associating attributes from Postgres file
with a
> key other than cat
> 
> Use db.select to set your database and then v.db.connect to link the
> cat in the vector data to the postgres DB
> 
> Cheers
> Daniel
> 
> On 8/8/07, Turner, James <James.Turner at kronos.com> wrote:
> >
> >
> >
> >
> > Ok, next dumb question that the documentation didn't seem to help
with
> >
> >
> >
> > I have the Census ZCTA data loaded up "locally" (not in a database),
and
> > some proprietary zip-code based data in a Postgres DB table.  The
> Postgres
> > data is keyed off the zip code, and obviously knows nothing about
the
> cat #s
> > of the imported e00 file with the ZCTA data.  Is there any
non-trivial
> way
> > to make the values in the Postgres table available to GRASS so that
I
> can
> > use it to do coloring of areas, etc.
> >
> >
> >
> > And yes, I know that ZCTA <> Zip Code, but it's close enough for
this
> > application.
> >
> >
> >
> > 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
> >
> >
> > _______________________________________________
> > grassuser mailing list
> > grassuser at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grassuser
> >
> >




More information about the grass-user mailing list