Hi Sue,
Thanks for sharing your code! I was wondering though, would you mind explaining the logic behind the following sentence taken from your official tool post under Description > Solution: "If a feature class is spatially joined to itself, the polygon id in the target and join will match in the top-most layer of polygons. This set of polygons will not overlap any other polygons." I am specifically confused by the phrase "top-most layer of polygons," and how this process produces non-overlapping features.
I tried manual testing to better understand it, and when I spatially joined a feature class to itself, the output was identical to the original feature class (with the exception of added fields from the join). Further, joining this back to the original feature class on polygon id did nothing but add more fields - as all the polygons matched/joined because they were all the same as the originals.
I have reviewed your code and am still stumped by this process. If you have the time and wouldn't mind going into the logic details, I'd love to understand what's happening here. I have been trying to implement a similar routine (but not using spatial join) that results in grouping points (via a flag field) into non-overlapping subsets based on either their buffer or distance to other points. I'm needing it for the Tabulate Area tool, which has the same overlapping areas problem as the Zonal Stats as Table tool. Any help would be appreciated! Thanks for your time!
Abby