Hey,<br>my 2 cents (sorry I can't access your example)<br><br>Depending on what you want, you may have interest in sampling :<br>you create a grid of point (there is a function) or a grid of polygon square.<br>Then you compute for each point(square) the number of polygon it is in (on simple sql query invovling count(*) OVER and st_intersects)<br>
Then when you want space where there are between N and M polygons overlaying, you just query the table with point/square with a WHERE count >N and count <M.<br><br>It should run very fast, even fater if you put btree index on the count result.<br>
I don't know what you want, but if this is some kind of indicator, sampling may be legitimate. <br>If you want crisp boundary, it may be used to fasten computing (doing the precise computing only on polygons on border)<br>
<br>Cheers,<br><br>Rémi-C<br><br> <br><div class="gmail_quote">2013/7/31 Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Jul 30, 2013 at 07:37:47PM -0700, Martin Davis wrote:<br>
> This kind of question can be answered by a classic N-polygon<br>
> overlay.  AFAIK PostGIS doesn't have such a function directly, so<br>
> you will have to compute the noding of the polygon linework,<br>
> followed by a polygonization step.  Then take a interior point of<br>
> each resultant polygon and compute how many source polygons it lies<br>
> in.  You can then union the set of polygons for each count of<br>
> interest.<br>
><br>
> Be warned - if the sample below is representative of your data, you<br>
> may well encounter TopologyExceptions, since it appears that there<br>
> is a lot of nearly coincident linework.<br>
><br>
> No doubt others can weigh in if there is a better way of doing this<br>
> in PostGIS.<br>
<br>
</div>Great idea, Martin!<br>
It could be implemented by building a topology and checking out the faces<br>
that partecipate in more than N TopoGeometry definitions. Would probably<br>
be pretty slow, but at least exceptions could be dealt with on a more<br>
localized way...<br>
<br>
--strk;<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> On 7/30/2013 9:37 AM, Sparr wrote:<br>
> >It was suggested on IRC that I ask this question to this mailing list.<br>
> ><br>
> >I have a set of 1000 (or many more) polygons, most of which<br>
> >intersect with each other. I want to produce a polygon (or set of<br>
> >polygons, or an empty set) describing the area covered by<br>
> >N-or-more of those polygons. For N=1, the answer is the union of<br>
> >all of the polygons. For N=1000, the answer is their intersection.<br>
> >The naive way to calculate N=2 through N=999 is to make a list of<br>
> >combinations of polygons, intersect those, and then union the<br>
> >results, but this will require a prohibitively large number of<br>
> >union and intersection operations in some cases.<br>
> ><br>
> >To illustrate the problem, here is an example with a smaller set<br>
> >of data (422 polygons right now):<br>
> ><br>
> ><a href="http://regionaldifferences.com/results.html?region=New%20England&lat=42&lon=-73&zoom=6" target="_blank">http://regionaldifferences.com/results.html?region=New%20England&lat=42&lon=-73&zoom=6</a><br>

> ><br>
> >If you hover your mouse over the center of Massachusetts you'll<br>
> >see that 98% of the polygons (415/422 currently) intersect there.<br>
> >Syracuse NY is about 25%.<br>
> ><br>
> >What I want is the outline of specific percentiles on this map. I<br>
> >want a single polygon representing the 50%-or-more area, and a<br>
> >single polygon representing the 90%-or-more area, etc.<br>
> ><br>
> >Can PostGIS do this without my needing to assemble a string of<br>
> >union and intersection operations for the query? I would prefer<br>
> >not to rasterize the data unless it proves infeasible to do this<br>
> >with the full precision vector data.<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br>