<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
text="#000000">
On 11/26/2011 05:10 PM, Daniel Lee wrote:
<blockquote
cite="mid:CAJHDHfodjSbfFMpAmO3grSji=qr98bb+LS++qyTmZzE-3_aO-A@mail.gmail.com"
type="cite">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:
<div><br>
</div>
<div>- 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.</div>
<div>- I can't export the areas to PostGIS though. Here's the
command I used and the results:</div>
<div>
<div>v.out.ogr in=Gebaeude_Globalstrahlung olayer=test
dsn=PG:host=localhost dbname=isis_db_extern user=lee
password=XXXXX type=area format=PostgreSQL</div>
<div>The map contains islands. To preserve them in the output
map, use the -c flag</div>
<div>ERROR 1: PQconnectdb failed.</div>
<div>FATAL: Ident authentication failed for user "lee"</div>
</div>
</blockquote>
<br>
<br>
I'm pretty sure this is still a PostgresQL permissions problem. Have
a look at your pg_hba.conf file. When you connect with psql do you
use a password? If not then just remove the password from the
dsn="..." string.<br>
<br>
<blockquote
cite="mid:CAJHDHfodjSbfFMpAmO3grSji=qr98bb+LS++qyTmZzE-3_aO-A@mail.gmail.com"
type="cite">
<div>
<div>ERROR 1: PostgreSQL driver doesn't currently support</div>
<div>database creation.</div>
<div>Please create database with the `createdb' command.</div>
<div>ERROR: Unable to open OGR data source 'PG:host=localhost
dbname=isis_db_extern user=lee password=XXXXX'</div>
</div>
<div><br>
</div>
<div>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.</div>
<div>- 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:</div>
<div>
<div>v.db.join map=Buildings col=cat
otable=Gebaeude_Globalstrahlung ocolumn=alk_id </div>
<div>DBMI-Postgres driver error:</div>
<div>Cannot execute:</div>
<div>ALTER TABLE Buildings ADD COLUMN cat INTEGER</div>
<div>
ERROR: column "cat" of relation "buildings" already exists</div>
<div>ERROR: Error while executing: 'ALTER TABLE Buildings ADD
COLUMN cat INTEGER</div>
<div>'</div>
</div>
</blockquote>
<br>
My guess: Wasn't your Gebaeude_Globalstrahlung table also a GRASS
vector? So it also has a cat column?<br>
What v.db.join does is try to create a new column in the map's table
for *each* column in the joined table. If a column name already
exists, it bails out. <br>
<br>
If both of these tables are attrib tables for existing GRASS
vectors, then you can go about this in another way: Within in
postgresql create a view which joins the attribs of both tables,
then connect the GRASS vector "buildings" to this view thru a second
layer. So something like:<br>
(in PostgreSQL:)<br>
# CREATE VIEW building_data AS <br>
SELECT b.<column1>, b.<column2>,....
g.<column1>, g.column2> ,... <br>
FROM buildings AS b JOIN Gebaeude_Globalstrahlung AS g ON
b.alk_id=g.cat;<br>
<br>
(and in GRASS)<br>
db.login driv=pg database="host=localhost,dbname=isis_db_extern"
user=lee<br>
<enter your password><br>
v.db.connect buildings driv=pg
database="host=localhost,dbname=isis_db_extern" user=lee
table=building_data layer=2<br>
<br>
Now you should see all the columns from both buildings and
Gebaeude_Globalstrahlun thru layer 2:<br>
v.db.select buildings layer=2<br>
<br>
HTH,<br>
Micha<br>
<br>
<blockquote
cite="mid:CAJHDHfodjSbfFMpAmO3grSji=qr98bb+LS++qyTmZzE-3_aO-A@mail.gmail.com"
type="cite">
<div>
<div>ERROR: Cannot continue (problem adding column).</div>
<div>ERROR: Cannot continue.</div>
</div>
<div><br>
</div>
<div>
The keys work, I've tried checking them in psql. The command</div>
<div>SELECT oska, value FROM buildings, gebaeude_globalstrahlung
WHERE alk_id = <a moz-do-not-send="true"
href="http://buildings.cat">buildings.cat</a>;</div>
<div>works just fine and gives me the correct values.</div>
<div><br>
</div>
<div>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!</div>
<br>
This mail was received via Mail-SeCure System.<br>
</blockquote>
<p><br>
</p>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
GIS Consultant, Arava Development Co.
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
</body>
</html>