I have a PostGIS table of polygons where some intersect with one another. This is what I'm trying to do:
- For a given polygon selected by id, give me all of the polygons that intersect. Basically,
select the_geom from the_table where ST_Intersects(the_geom, (select the_geom from the_table where source_id = '123'))
- From these polygons, I need to create a new polygons such that intersection becomes a new polygon. So if polygon A intersects with polygon B, I will get 3 new polygons: A minus AB, AB, and B minus AB.
Any ideas?