[postgis-users] How can I generate all the intersections from a set of polygons?

pcreso at pcreso.com pcreso at pcreso.com
Mon Feb 18 13:44:14 PST 2013


Hi,

I'm having trouble working out how best to do this... hopefully someone can advise.

I have a dataset of start/finish positions (plus lots of other attributes)
I create a linestring from the points
I buffer the linestrings to create a polygon for each.
I create a grid (set of square polygons)
I
 overlay (intersect) these to generate cell bounded sets of cropped 
transect polygons which can be used to provide a range of statistics per
 cell, and create maps showing cell based trends.

This all works (very) well.

Now,
 for each cell,  I want to generate all the polygons formed by 
overlaying all the cropped transect polygons, so I can for each one, 
return the number of transect polygons it intersects, so for each cell 
I'll potentially get a set of polygons with various values, 0 (not 
crossed at all), 1 (only one transect crossed here), 2 (2 transects 
crossed here), etc. 

The goal is a benthic impact model, where, 
for each cell, if we assume that each transect has an impact of X, we 
can say how much of each cell has undergone how much impact.



Given the source points are timestamped, we can also do spatio-temporal analyses of the data.

Given
 the ST_intersection function in Postgis does not accept a geometry 
collection as input, then the only approach I can see is to grab the 
intersection of every polygon with every other polygon, then remove any 
duplicates. Then iteratively repeat with the intersections of the 
intersections until there are no new ones discovered. Each one can then easily be queried against the original cropped polygons to get the count (no of times it was crossed).

Given the heavy use of R here, I'd be happy with an R (or PL/R) based solution as well.

Can
 this be implemented as a UDF function, perhaps accepting the set of 
polygons to use as a GeometryCollection, & returning the set of all 
intersections?

Does anyone have any suggestions for a fast & elegant solution?

Thanks,

   Brent Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130218/ac7d0e93/attachment.html>


More information about the postgis-users mailing list