3

I'm identifying if a point locates within a polygon. I have a dataframe contains the points and another dataframe contains the polygons, so I want to spatial join them like:

gpd.sjoin(df_points, df_polygons, how = 'left')

I know the default is op=intersects, but how do intersects and within differ? Which one should I use for my purpose?

Thanks

Lumos
  • 1,303
  • 2
  • 17
  • 32
  • Geopandas uses shapely for such operations, you can see the documents here: https://shapely.readthedocs.io/en/stable/manual.html#set-theoretic-methods – swatchai Jul 24 '21 at 00:49
  • 2
    In the case of point within a polygon, there is no difference in the result. However, you may notice a difference in performance. – martinfleis Jul 24 '21 at 10:59

1 Answers1

1

The PostGIS Tutorial has some very good graphics that explain the different Spatial Joins.

Intersects

Within

four-eyes
  • 10,740
  • 29
  • 111
  • 220