def overlay_proportion(row, df, overlay_field, overlay_category):
    """
        calculate the fraction of area covered by an overlay. input df is a
        GeoDataFrame resulting from an intersection of two mutlipolygon data sets.
        """
    ov_frac = 0
    study_area_df = df.loc[df['idx1'] == row.name]
    study_area = study_area_df.geometry.area.sum()
    if study_area > 0:
        overlay_df = study_area_df.loc[study_area_df[overlay_field] ==
            overlay_category]
        overlay_area = overlay_df.geometry.area.sum()
        ov_frac = overlay_area / study_area
    return ov_frac
