0
votes

I have a set of candidate points and a set of reference points in lon/lat coordinate space. I have created a bounding box around each of my candidate points, and I would like to check the reference points to see what reference points fall within each box.

What is the advantage of using a geopandas spatial join over something like slicing the geopandas frame with .cx[lon1:lon2, lat1:lat2] ? IS there a difference?

1
Spatial join will likely be faster. It is using a spatial index and the query is done in C, while .cx is non-indexed spatial operation, which can be relatively expensive.martinfleis

1 Answers

0
votes

A key difference between these two is what parameters they take.

According to the docs, the cx method performs coordinate based indexing, it takes slices of coordinate ranges. The spatial join (docs) takes two GeoDataFrames.

In my limited testing, the cx method is ~6x faster than spatial join.