I have about 1000 coordinates and 3000 shapes. My goal is to see if a coordinate falls within each shape:
import pandas as pd
import shapefile
from shapely.geometry import Point, shape
coords = pd.read_csv("coords.csv")
areas = shapefile.Reader("./areas")
shapes = areas.shapes()
for a, b in zip(coords["a"], coords["b"]):
for i in shapes:
if (Point((a, b)).within(shape(i))):
print("in shape")
Test prints show that there are heaps of calculations going on but the loop just won't end. For such a small amount of coordinates and shapes I believe it is to do with my code.