[GRASS-user] Joining vectors by location

Daniel Lee lee at isi-solutions.org
Sat Nov 26 10:10:31 EST 2011


Alright, I just tried it again and, again, no dice, although at least my
thematic tables are stored in the PostGIS DB. Here's what's going on:

- I am the owner of the tables that are created in PostGIS. Their names are
lower case versions of the names of the maps they're attached to in GRASS.
They don't seem to contain any geometric/geographic data though.
- I can't export the areas to PostGIS though. Here's the command I used and
the results:
v.out.ogr in=Gebaeude_Globalstrahlung olayer=test dsn=PG:host=localhost
dbname=isis_db_extern user=lee password=XXXXX type=area format=PostgreSQL
The map contains islands. To preserve them in the output map, use the -c
flag
ERROR 1: PQconnectdb failed.
FATAL:  Ident authentication failed for user "lee"
ERROR 1: PostgreSQL driver doesn't currently support
database creation.
Please create database with the `createdb' command.
ERROR: Unable to open OGR data source 'PG:host=localhost
dbname=isis_db_extern user=lee password=XXXXX'

Nonetheless, I'm able to access the database with my username and password
in psql. Plus, I was able to reproject the maps into this location using
the same authentification credentials, so they shouldn't be the problem.
The database already exists, so I don't know why it wants me to use
createdb. My user was definitely able to create tables that contain the
attributes of the geometries that I see in GRASS. The geometries show up
fine with their attributes, at least in GRASS.
- I'm also unable to do a table join. I want to join "Buildings" to
"Gebaeude_Globalstrahlung" by a primary key - in "Buildings" it's "cat", in
"Gebaeude_Globalstrahlung" it's "alk_id". Those are the ones I made using
v.distance as a way to do a spatial join. Here's the command:
v.db.join map=Buildings col=cat otable=Gebaeude_Globalstrahlung
ocolumn=alk_id
DBMI-Postgres driver error:
Cannot execute:
ALTER TABLE Buildings ADD COLUMN cat INTEGER
ERROR:  column "cat" of relation "buildings" already exists
ERROR: Error while executing: 'ALTER TABLE Buildings ADD COLUMN cat INTEGER
'
ERROR: Cannot continue (problem adding column).
ERROR: Cannot continue.

The keys work, I've tried checking them in psql. The command
SELECT oska, value FROM buildings, gebaeude_globalstrahlung WHERE alk_id =
buildings.cat;
works just fine and gives me the correct values.

Anybody have an idea of what's going on? I think the DB is doing okay, it
seems that something's not working in GRASS. Whatever the case, I just
can't get the vectors to go into the database. Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111126/2d7ff3de/attachment.html


More information about the grass-user mailing list