I have a geopandas DataFrame with Polygon geometry and another one with POINT geometry. I'd like to do a spatial join between them and randomly select a set of points that are within certain distance or close to the polygon.
Here's some sample data:
https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=2c3c5863af9fe855491e4ef71f21a64b
Criteria:
Select n randomly sampled points from top m nearest points between gpd2.geometry (Point) to each gpd1.geometry (Polygon).
import geopandas as gpd
import numpy as np
gpd_merged = gpd.sjoin(
gpd1, # polygon geometry
gpd2, # point geometry (randomly sample and join)
how = 'left',
distance_col = "distances"
)

