def count_intersections(self, target, source):
        # Set up progress bar
        num_points = source.GetFeatureCount()
        if not self.args.suppress_output:
            pbar = progressbar.ProgressBar(
                widgets=[
                    'Binning: ',
                    progressbar.Percentage(),
                    progressbar.Bar()
                ],
                maxval=num_points
            )
            pbar.start()

        pbar_count = 0
        another_point = True
        while (another_point):
            point = source.GetNextFeature()
            if point:
                point_geom = point.GetGeometryRef()
                another_polygon = True
                while (another_polygon):
                    polygon = target.GetNextFeature()
                    if polygon:
                        poly_geom = polygon.GetGeometryRef()
                        if point_geom.Intersects(poly_geom):
                            # Intersection
                            count = polygon.GetFieldAsInteger('COUNT')
                            polygon.SetField('COUNT', count + 1)
                            target.SetFeature(polygon)
                        polygon.Destroy()
                    else:
                        another_polygon = False
                        target.ResetReading()
                point.Destroy()
            else:
                another_point = False
                source.ResetReading()
            if not self.args.suppress_output:
                # Update progress bar
                pbar.update(pbar_count)
                pbar_count = pbar_count + 1
        if not self.args.suppress_output:
            pbar.finish()
Counts the number of points in `source` that intersect each polygon of
dataset/ETHPy150Open kevinschaul/binify/binify/binify.py/Binifier.count_intersections