def search_gdf_polygon(gdf, tile_polygon):
    "Find polygons in a GeoDataFrame that overlap with `tile_polygon` .\n\n    Arguments\n    ---------\n    gdf : :py:class:`geopandas.GeoDataFrame`\n        A :py:class:`geopandas.GeoDataFrame` of polygons to search.\n    tile_polygon : :py:class:`shapely.geometry.Polygon`\n        A :py:class:`shapely.geometry.Polygon` denoting a tile's bounds.\n\n    Returns\n    -------\n    precise_matches : :py:class:`geopandas.GeoDataFrame`\n        The subset of `gdf` that overlaps with `tile_polygon` . If\n        there are no overlaps, this will return an empty\n        :py:class:`geopandas.GeoDataFrame`.\n\n    "
    sindex = gdf.sindex
    possible_matches_index = list(sindex.intersection(tile_polygon.bounds))
    possible_matches = gdf.iloc[possible_matches_index]
    precise_matches = possible_matches[possible_matches.intersects(tile_polygon)]
    if precise_matches.empty:
        precise_matches = gpd.GeoDataFrame(geometry=[])
    return precise_matches
Find polygons in a GeoDataFrame that overlap with `tile_polygon` .

Arguments
---------
gdf : :py:class:`geopandas.GeoDataFrame`
    A :py:class:`geopandas.GeoDataFrame` of polygons to search.
tile_polygon : :py:class:`shapely.geometry.Polygon`
    A :py:class:`shapely.geometry.Polygon` denoting a tile's bounds.

Returns
-------
precise_matches : :py:class:`geopandas.GeoDataFrame`
    The subset of `gdf` that overlaps with `tile_polygon` . If
    there are no overlaps, this will return an empty
    :py:class:`geopandas.GeoDataFrame`.
def search_gdf_polygon(gdf, tile_polygon):
    "Find polygons in a GeoDataFrame that overlap with `tile_polygon` .\n\n    Arguments\n    ---------\n    gdf : :py:class:`geopandas.GeoDataFrame`\n        A :py:class:`geopandas.GeoDataFrame` of polygons to search.\n    tile_polygon : :py:class:`shapely.geometry.Polygon`\n        A :py:class:`shapely.geometry.Polygon` denoting a tile's bounds.\n\n    Returns\n    -------\n    precise_matches : :py:class:`geopandas.GeoDataFrame`\n        The subset of `gdf` that overlaps with `tile_polygon` . If\n        there are no overlaps, this will return an empty\n        :py:class:`geopandas.GeoDataFrame`.\n\n    "
    sindex = gdf.sindex
    possible_matches_index = list(sindex.intersection(tile_polygon.bounds))
    possible_matches = gdf.iloc[possible_matches_index]
    precise_matches = possible_matches[possible_matches.intersects(tile_polygon)]
    if precise_matches.empty:
        precise_matches = gpd.GeoDataFrame(geometry=[])
    return precise_matches