I have two dataframes, both containing geometry columns. The first dataframe contains MULTIPOLYGONs while the second one contains POINTs. My aim is to join the dataframes so each POINT will be assigned to corresponding POLYGON. DF_polygons has 2480 rows and DF_points has aroud 150.000 rows (10 tractors with GPS driving over fields, data coming in every few seconds).

I used this code to join dataframes (also tried within and contains):

points_in_polygons = gpd.sjoin(DF_points, DF_polygons, op='intersects', how='inner)

The problem is, it returns a result with approximately 30.000.000 rows in all 3 cases. The desirable result would have 100.000 rows - so each unique point would be assigned to one of 2480 multipolygons.

Is it possible that the problem is in overlapping polygons? How can I deal with it? Which packages should I use? I am completely new to GeoPandas.

  • I think you are better of if you look at each geometry separated. You will have to extract the shapely geometries from the dataframe and check for intersection
    – Leo
    Jun 2, 2020 at 9:20
  • If i understand right, i need an efficient way to check the intersection between 2480 multipolygons?
    – KayEss
    Jun 2, 2020 at 9:45
  • I am not really sure what you are trying to achieve right now. do you just want to know if your polygons overlap or do you want a solution to your assignment problem?
    – Leo
    Jun 2, 2020 at 12:15
  • If you want to check if they overlap, you can either do gpd.plot or save it as a shapefile and visualise it in qgis
    – Leo
    Jun 2, 2020 at 12:22

1 Answer 1


The reason of such a huge result was in overlapping polygons. To detect polygons that overlap i used this:

for index, row in df_polygons.iterrows():

# check if intersection occured
if len(overlaps)>0:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.