[GIS] Counting overlapping polygons in GeoJSON to result in new set of polygons

algorithmgeojsonoverlapping-features

I have 100 polygons in a GeoJSON file that partially overlap each other. I would like to produce 100 new polygons as follows:

  • The area covered by any of the original 100. This is their union.
  • The area covered by at least two of the original 100.
  • The area covered by all but one of the original 100.
  • The area covered by all of the original 100. This is their intersection.

(I'm actually going to only keep 5-10 of these 100 results, but I expect the process for generating all 100 of them is the same as generating a subset of them)

What software / functions can I use to do this?


One approach I've already encountered in another similar project involves rasterizing all of the original polygons, then counting the overlapping pixels and producing new polygons from that data. This approach loses precision earlier than I would like to (I want to maintain near perfect precision up until the end of the process, THEN simplify things for display).


I could do this semi-manually with hundreds of union and intersection operations. This approach is not ideal because I want to re-run this process at intervals in the future as the dataset grows.

Best Answer

I would tend to agree that a script is needed.. however, in theory one could intersect everything, keeping the ID attribute of every parent polygon. Then each fragments "parentage" and thus any combination of parents could be established through queries.

This is basically a vector version of the raster approach. Given the potential problems with sliver polygons, likely limits in vector topology precision and area calculation, not to mention processing time, I would not discount the raster version. If a sufficient resolution were feasible the final precision might not be much worse - or would atleast be more easily assessed.