9

I'm trying to use PostGIS to do a 'union' of polygons. When I Googled "PostGIS Union", I found the ST_Union function, which performs what I would call a 'dissolve,' not a Union. What I actually want to do is what GRASS refers to as an "Overlay" with the "OR" operator, or QGIS/ArcGIS just simply call a "Union." For example:

enter image description here

From what I can tell, in PostGIS it appears I need to use both ST_Intersection and ST_SymDifference together to get the results I am seeking. I have had some success with the following syntax, but it's terribly inefficient. Is there a better/more efficient way to do what I'm hoping to accomplish?

INSERT INTO "CombinedResults" ("geom")
SELECT ST_SymDifference(
        "test1".GEOM
        ,"test2".GEOM
        )
    FROM "test1","test2";

INSERT INTO "CombinedResults" ("geom")
SELECT ST_Intersection(
        "test1".GEOM
        ,"test2".GEOM
        )
    FROM "test1","test2"
Samane
  • 989
  • 6
  • 23
Darren Cope
  • 6,616
  • 2
  • 32
  • 47

1 Answers1

-1

Maybe ST_ConvexHull will help you. See this snippet to understand how it works http://www.bostongis.com/postgis_concavehull.snippet

winsent
  • 366
  • 1
  • 8
  • This is not a definitive answer, also the relevant information from the link should be provided in the answer in order to mitigate link rot – raphael Mar 26 '16 at 18:19