[postgis-users] Union of 7 datasets

Obe, Regina robe.dnd at cityofboston.gov
Thu Aug 23 06:34:06 PDT 2007


Andreas,

It would help to know what your table structure looks like and why do you want to put them all in a single geometry?

I'm imaging you are you doing something like

SELECT g1.somefield, geomunion(geomunion(g1.the_geom, g2.the_geom), g3.the_geom)
FROM g1 INNER JOIN g2 on g1.somefield = g2.somefield INNER JOIN g3 on g2.somefield = g3.somefield
GROUP BY g1.somefield

or 

SELECT g1.somefield, geomunion(gt.the_geom)
FROM (SELECT somefield, the_geom FROM g1 UNION SELECT somefield, the_geom FROM g2 ...) gt
GROUP BY gt.somefield


If I have 7 different tables that have pretty much the same structure, but for logistical or other technical reasons (such as each has additional attributes distinct from one another), I need to keep them as separate tables, then I usually use inherited tables for that. That way when I need to join all datasets at once, I can simply query the parent table and it will automatically drill down to the child tables. Not sure if that helps more than it confuses your situation.

Then instead of the above I can simply do

SELEG myparenttable.somefield, geomunion(myparenttable.the_geom)
FROM myparenttable
GROUP by gh.somefield



Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Andreas Laggner
Sent: Thursday, August 23, 2007 9:11 AM
To: PostGis_Mailinglist
Subject: [postgis-users] Union of 7 datasets

Hi users,

i want to put together 7 datasets to have all the different refuges in 
one table (and in one geometry). Am i doing right with 6 times geomunion 
(that´s much to type with all the attributes) or is there a more 
effective way?

cheers Andreas

-- 
Dipl. Geoökologe Andreas Laggner
Institut für Ländliche Räume (LR)
Bundesforschungsanstalt für Landwirtschaft (FAL)

Institute of Rural Studies
Federal Agricultural Research Centre (FAL)

Bundesallee 50
D-38116 Braunschweig

Tel.: (+49) (0)531 596 5515
Fax: (+49) (0)531 596 5599
E-mail: andreas.laggner at fal.de
Homepage: http://www.lr.fal.de/ 

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list