0

I'm trying to make a spatial verification.

I have a geodataframe with 245 points, and I'm having a bad time trying to check if they're inside a polygon or not.

I've been attempting this code, but I just won't work. As far as I understood, geodataframes are slightly different from dataframes when in a for loop.

for x in event_log_c.geometry:
    i = event_log_c.iloc[x].within(hexa)
    print(i)

After running this, it brings me this error:

TypeError: Cannot index by location index with a non-integer key

hexa is the polygon geodataframe, and event_log_c is the 245 points geodataframe.

How can I make a spatial verification iterating a geodataframe? Are there any way of doing this?

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389

0 Answers0