On Tue, Sep 11, 2012 at 04:29:07PM +0200, Markus Innerebner wrote: > Hello, > > I have a question regarding the st_difference operation: > > I want to identify the non overlapping area of a given polygon, that might > intersect with arbitrary other polygons. > I realized, that st_difference operation works only with two parameters. The > API says not to use it with geometry collections. > > In order to realize this, I needed to do combine st_intersection with > st_difference in recursive manner as shown below with the following output: > > > st_intersection( > st_intersection( > st_difference( > st_buffer(st_pointfromtext('POINT(680386.8879388 > 5152170.83093339),82344),9000.0), > st_buffer(st_pointfromtext('POINT(688402.843016069 > 5157054.21005474),82344),3000.0) > ), > st_difference( > st_buffer(st_pointfromtext('POINT(680386.8879388 > 5152170.83093339),82344),9000.0), > st_buffer(st_pointfromtext('POINT(674802.141078014 > 5161560.18713918),82344),5860.0) > ) > ),st_difference( > st_buffer(st_pointfromtext('POINT(680386.8879388 > 5152170.83093339),82344),9000.0), > st_buffer(st_pointfromtext('POINT(680910.532411225 > 5142908.46168964),82344),5000.0) > ) > ) > ) > ) > > my question now is: Is there a simpler way?
You may union the parts to subtract and then call difference only once. Leaving out the parts that do not intersect with the bounding box of the first geometry is advisable. --strk; http://www.cartodb.com - Map, analyze and build applications with your data ~~ http://strk.keybit.net _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users