I have some polygons and points that I know overlay which look like this:
One thing to note is that in the polygon shapefile there can be multiple which overlap and I want to intersect through all of them, thus a single point could potentially return numerous rows in the output. I have been trying this code:
from shapely.geometry import * import geopandas as gpd pts = gpd.read_file("/path.shp") poly = gpd.read_file("/path.shp") combined = pd.DataFrame() for key , grp in pts.groupby('id'): inter = poly.intersects(grp['geometry']).to_frame() combined = combined.append(inter)
but the output of
False for every single instance. Is there anyway to intersect points and polygons in geopandas or shapely?
id is just the row indicator for each point.
Yearcolumn. I ultimately want to know what the year is for each point. I can determine this myself though if the correct
Falseintersections occur though.