I added code that should do what you want with some minor changes.
I think your problem arose for one of two reasons:
You built the spatial index incorrectly. Your responses to my comments suggested that you were not fully aware of how the spatial index is created.
The bounding box for your spatial query was not built correctly.
I will discuss both possibilities below.
Building a spatial index
As it turned out, the spatial index is built simply by entering:
sindex = gpd_df.sindex
Magic.
But where gpd_df.sindex get its data from? It is assumed that the data is stored in a geometry column in shapely format. If you have not added data to such a column, this will raise a warning.
Proper initialization of the data frame will look like this:
#Generate random points throughout Oregon x = np.random.uniform(low=oregon_xmin, high=oregon_xmax, size=10000) y = np.random.uniform(low=oregon_ymin, high=oregon_ymax, size=10000)
Seeing the example code example above in your question would help you diagnose your problem and continue solving it.
Since you didn’t receive the extremely obvious geopandas warning when a geometry column is missing:
AttributeError: geometry data has not yet been set (expected in column geometry).
I think you probably did this part right.
Building a bounding box
In your question, you form a bounding box as follows:
nearest_index = list(sindex.intersection((pt_center.LATITUDE-r, pt_center.LONGITUDE-r, pt_center.LATITUDE+r, pt_center.LONGITUDE+r)))
As it turned out, the bounding rectangles have the form:
(West, South, East, North)
At least they are executed for stylized XY points, for example. shapely.geometry.Point(Lon,Lat)
In my code, I use the following:
bbox = (cpt.x-radius, cpt.y-radius, cpt.x+radius, cpt.y+radius)
Working example
Combining the above leads me to this working example. Please note that I also demonstrate how to sort points by distance, answering your second question.
(What I requested in the comments is code that looks like the previous one, but that illustrates your problem. Note the use of random to briefly create a data set for experiments.)