[postgis-users] Using PostGIS for partial intersection/union of many polygons

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jul 30 09:46:24 PDT 2013


I'm not sure I fully understand the problem but can't you do all n=1000 
intersection so you get all the smallest pieces into a table maybe 
adding attributes about which polygons these contributed to the fragments.

Then for any percentile run a query to select the fragments represented 
by that and st_union or st_collect them into your results.

-Steve

On 7/30/2013 12:37 PM, Sparr wrote:
> It was suggested on IRC that I ask this question to this mailing list.
>
> I have a set of 1000 (or many more) polygons, most of which intersect
> with each other. I want to produce a polygon (or set of polygons, or an
> empty set) describing the area covered by N-or-more of those polygons.
> For N=1, the answer is the union of all of the polygons. For N=1000, the
> answer is their intersection. The naive way to calculate N=2 through
> N=999 is to make a list of combinations of polygons, intersect those,
> and then union the results, but this will require a prohibitively large
> number of union and intersection operations in some cases.
>
> To illustrate the problem, here is an example with a smaller set of data
> (422 polygons right now):
>
> http://regionaldifferences.com/results.html?region=New%20England&lat=42&lon=-73&zoom=6
>
> If you hover your mouse over the center of Massachusetts you'll see that
> 98% of the polygons (415/422 currently) intersect there. Syracuse NY is
> about 25%.
>
> What I want is the outline of specific percentiles on this map. I want a
> single polygon representing the 50%-or-more area, and a single polygon
> representing the 90%-or-more area, etc.
>
> Can PostGIS do this without my needing to assemble a string of union and
> intersection operations for the query? I would prefer not to rasterize
> the data unless it proves infeasible to do this with the full precision
> vector data.
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list