Check For Points Within Polygon From Geodataframe
I have a shapefile of Indian districts: full_state_df = gpd.read_file('kerala/shapefiles/district.shp') print (full_state_df.head()) Result: DISTRICT ...
Solution 1:
IIUC, you can do this if you use geodataframes for your points and polygons. The points_in_polygon_gdf will contain the points that are within each district.
points_in_polygons_gdf = gpd.sjoin(points_gdf, polygons_gdf, op='within', how='inner')
Post a Comment for "Check For Points Within Polygon From Geodataframe"