I am attempting to count how many dissemination areas are in a group of school catchment areas. I am using two shapefiles from different sources and use GeoPandas' overlay function to generate a dataframe with the overlapping areas.
In the attached image, the coloured areas represent catchments, the solid lines represent the boundary of dissemination areas.
This code generates the dataframe with the overlaps.
import geopandas as gpd
schools = gpd.read_file(path to shapefile)
schools=schools.to_crs(epsg=26917)
da = gpd.read_file(path to shapefile)
da=da.to_crs(epsg=26917)
overlaps = gpd.overlay(da,schools, how='intersection')
The code functions properly, but gave me unexpected results: the counts were WAY high. The issue seems to be that each catchment has points where it overlaps minimally with the adjacent dissemination areas. For example, the second image is zoomed in area and you'll notice the purple catchment just barely squeaks over the line which is in the middle of a river. As it stands, the script captures that as being part of the purple and green catchment areas, which would be fine if it were truly part of both catchment areas.
One idea I had was possibly trimming a few meters from the edge of each polygon to reduce the number of "collisions" between adjacent polygons, but I don't know if such a thing is possible. Other suggestions are welcome too.