<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div>How About</div><div><br></div><div>CREATE TABLE newtable AS(</div><div>SELECT a.col1, a.col2, b.col1, b.col2, ST_UNION(b.the_geom, b.the_geom) AS the_geom</div><div>FROM</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>table1 a, table2 b</div><div>WHERE</div><div><br></div><div>ST_INTERSECTS(a.the_geom, b.the_geom))</div><div><br></div><div>changing cols to the columns you want.</div><div><br></div><div>Phil</div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-size: 12pt; font-family: 'Courier New', courier, monaco, monospace, sans-serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <font size="2" face="Arial"> <hr size="1">  <b><span
 style="font-weight:bold;">From:</span></b> "Carpenter, Craig" <Craig.Carpenter@dec.wa.gov.au><br> <b><span style="font-weight: bold;">To:</span></b> "postgis-users@postgis.refractions.net" <postgis-users@postgis.refractions.net> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, 8 December 2011, 5:51<br> <b><span style="font-weight: bold;">Subject:</span></b> [postgis-users] Using PostGIS to replicate ESRI Union Output<br> </font> <br>Hello All<br><br>I'm a new user to PostGIS and am trying to get my head around it. I come from an ESRI background and am currently trying to replicate the ESRI Union Analysis function, unfortunately I'm not having much luck.<br><br>I've read alot of proposed solutions but nothing comes close to providing the output that mimics the ESRI Union output.<br><br>Essentially what I'm trying to do is overlay 2x or more vector datasets over the top of each other and create new geometry where they
 overlap and cut each other, while combining the attributes of all input spatial datasets. The attached picture demonstrates what I'm trying to do. Its important that were overlap occurs a new polygon is created which combines the attribution of the overlapping layers in a single record / row.<br><br>"Union All" doesnt work very well as I have many differing columns.<br><br>I have managed to get the geometry overlapped and new polygons created where overlaps occur, however I havent managed to get the inner rings sorted. However the attributes from varying input datasets are split over seperate rows.<br><br>The process that I've currently worked on is summarised below:<br>1) Combine input datasets into a single table using "Union All" and null spacers<br>2) Dump multi polygon to single polygon<br>3) Convert to exterior ring, union, and polygonize<br>4) Do pointonsurface analysis to create point layer centroids of new polygonized polygons<br>5) Create join
 table where pointonsurface point layer intersects with original data to extract attribution<br>6) Join attributes from the join table to the pointonsurface point layer<br>7) Create new table combining the polygonized geometry with the attribution of the point layer where intersects<br><br><br>Any help or advice would be appreciated, I've almost pulled all my hair out....<br>Regards<br>Craig<br><br><br>This email, together with any attachments, is intended for the<br>addressee only. It may contain confidential or privileged information.<br>If you are not the intended recipient of this email, please notify<br>the sender, delete the email and attachments from your system and<br>destroy any copies you may have taken of the email and its attachments.<br>Duplication or further distribution by hardcopy, by electronic means<br>or verbally is not permitted without permission.<br><br>_______________________________________________<br>postgis-users mailing
 list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br><br> </div> </div> </blockquote></div>   </div></body></html>