# Count number of overlapping polygons with Julia?

**URL:** <https://discourse.julialang.org/t/count-number-of-overlapping-polygons-with-julia/57400>\
**Category:** General Usage\
**Tags:** question, geo, gis, geometry, libgeos\
**Created:** [March 17, 2021, 5:31pm UTC](https://discourse.julialang.org/t/count-number-of-overlapping-polygons-with-julia/57400 "2021-03-17T17:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vlandau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vlandau/32/8986_2.png) [@vlandau](https://discourse.julialang.org/u/vlandau)\
**Post date:** [March 17, 2021, 5:31pm UTC](https://discourse.julialang.org/t/count-number-of-overlapping-polygons-with-julia/57400/1 "2021-03-17T17:31:31Z")

</div>

Hi all, I have a series of partially overlapping polygons in a single shapefile, and I need to create a new shapefile that has the number of overlapping polygons in each intersection. e.g. [this](https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/count-overlapping-features.htm).

There is a way to do it in R (`sf::st_intersection`) but I found that to be incredibly buggy, and it flat out did not work for the shapefile of interest. I’ve googled around for a way to do this with other GIS software, such as QGIS, PostGIS, and GDAL/OGR, but there seems to be no straightforward and efficient way to do what I need on any of those platforms (and this may also just be because I am illiterate in SQLite)

I’m hoping the the geometry packages in Julia might offer a fast and relatively straightforward way to do this – maybe LibGEOS.jl? Any help and/or code would be greatly appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![vlandau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vlandau/32/8986_2.png) [@vlandau](https://discourse.julialang.org/u/vlandau)\
**Post date:** [March 17, 2021, 5:43pm UTC](https://discourse.julialang.org/t/count-number-of-overlapping-polygons-with-julia/57400/2 "2021-03-17T17:43:44Z")

</div>

The issue with R seems to actually be rooted in GEOS. I’m getting errors about non-noded intersections

---

<div class="post-metadata">

**Author:** ![floswald](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/floswald/32/195_2.png) [@floswald](https://discourse.julialang.org/u/floswald)\
**Post date:** [July 19, 2022, 8:36pm UTC](https://discourse.julialang.org/t/count-number-of-overlapping-polygons-with-julia/57400/3 "2022-07-19T20:36:30Z")

</div>

hey, i have exactly the same use case. what did you end up doing here? thanks
