With PostGIS, I need to perform the union of two polygon layers that have intersection areas and distinct areas while preserving all limits. I need to extract separated polygons for each intersected and distinct areas from both layers.
Using QGIS, the tool is called "Vector > Geoprocessing > Union"
here is a visual of the problem:
Two Input polygon layers (green vs red dashes) =
Output polygon layer (one distinct color per polygon)=
I need to do it with PostGIS. st_union seems to do a different job. Any idea?
ST_Intersection()
andST_Difference()
, them scan all with usual SQL UNION, them merge all in a layer byST_Collect()
(faster tham ST_Union).