<div class="gmail_quote">Alright, I think the last suggestion got me a LOT further.</div><div class="gmail_quote"><br></div><div class="gmail_quote">2011/11/26 Micha Silver <span dir="ltr"><<a href="mailto:micha@arava.co.il">micha@arava.co.il</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="direction:ltr" bgcolor="#ffffff" text="#000000">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></div></blockquote><div>Gotcha. What I don't understand though is how you join a table at all then. Don't you have to base the join on columns that are already there? No matter if I'm working with vectors or pure tables or a combination thereof, the columns with the key have to be there in order to join them, right? Or maybe I'm understanding it completely wrong ;)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="direction:ltr" bgcolor="#ffffff" text="#000000">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=<a href="http://g.cat" target="_blank">g.cat</a>;<br></div></blockquote><div>Step one, that worked great. In fact, I'm working with four different maps that I want to join, so I went ahead and did the following:</div>
<div><div><div>CREATE VIEW buildings_globalstrahlung AS</div><div> SELECT <a href="http://g.cat">g.cat</a>, b.objektid, b.oska, g.globalstra</div><div> FROM buildings AS b JOIN gebaeude_globalstrahlung AS g ON <a href="http://b.cat">b.cat</a>=g.alk_id;</div>
<div>CREATE VIEW buildings_globalstrahlung_dachflaeche AS</div><div> SELECT <a href="http://b.cat">b.cat</a>, b.objektid, b.oska, b.globalstra, d.dachflaech</div><div> FROM buildings_globalstrahlung AS b JOIN gebaeude_dachflaeche AS d ON <a href="http://b.cat">b.cat</a>=d.alk_id;</div>
<div>CREATE VIEW buildings_globalstrahlung_dachflaeche_nutzflaeche AS</div><div> SELECT <a href="http://b.cat">b.cat</a>, b.objektid, b.oska, b.globalstra, b.dachflaech, n.nutzflaech</div><div> FROM buildings_globalstrahlung_dachflaeche AS b JOIN gebaeude_nutzflaeche AS n ON <a href="http://b.cat">b.cat</a>=n.alk_id;</div>
</div></div><div><br></div><div>I'm sure there's a much more elegant way of doing it in a single command, but I don't know it. Any suggestions?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="direction:ltr" bgcolor="#ffffff" text="#000000">
<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 </div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="direction:ltr" bgcolor="#ffffff" text="#000000">Now you should see all the columns from both buildings and
Gebaeude_Globalstrahlun thru layer 2:<br>
v.db.select buildings layer=2</div></blockquote></div><div>That worked too.</div><div>v.db.connect -o map=Buildings@PERMANENT table=public.results layer=2</div><div>got me connected to it. I'm really, really happy now :D If I copy the table now, will I have a hard copied version of the table, or will it still be dependent on the joins that went before?</div>
<div> </div><div>Thanks a lot for the help! It's still a bit strange that my attribute tables are in Postgres but my geometries not, so that I have to export them to PostGIS by v.out.ogr --> *.shp | shp2pgsql, but I can live with that if nobody else can figure out the reasons why. I sure can't at the moment either :D</div>
<div><br></div><div>Boy, is that a load off, I'm quite relieved. Thanks again for all the suggestions!</div>