[postgis-users] Make Union between 2 layers

Birgit Laggner birgit.laggner at ti.bund.de
Tue Feb 9 00:15:46 PST 2016

Hi Alain,

your approach sounds good to me. I used a similar approach some time 
ago. As for the creation of the bigger polygon during the 2nd step, with 
my older PostGIS version, I sometimes came across topology exceptions 
using the st_union function for this. Maybe this is not a problem 
anymore, but if you meet problems with topology exceptions, a possible 
solution could be to use st_collect instead of st_union.
Also, I want to address that your data might have polygons that don't 
intersect. You might need to keep that in mind, so you don't loose any 
polygons during the process.
Just to be thorough, in my case, the operation became a little bit 
complex because the data contained intersecting polygons within the same 
table, causing multiple intersection and difference results for the same 
space. Therefore, you might want to check your data on selfintersection 
issues, if you're not sure there are none.



Am 05.02.2016 um 15:57 schrieb Alain Benard:
> Hi,
> I would like to make an operation between two tables with geometry 
> (polygon) - user's GIS call this operation a UNION.
> I think this :
>   * Step1 : make st_intersection (where st_intersects) and obtains the
>     4 little square with attributes from the two table. I call the
>     result layerintersect
>   * Step 2 : make a unique polygon with the layerintersect (Step 1)
>   * Step 3 : use this polygon  with the two table and st_difference
>   * assembly the 3 result (layerintersect + the 2 difference) with a
>     classic union (SQL)
> The second step make a big polygon and for other data it can be a 
> problem ??
> Is there another way to make this job?
> Thanks in advance.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160209/8cae1def/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 11720 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160209/8cae1def/attachment.png>

More information about the postgis-users mailing list