I have a polygon vector layer with potential sample plot locations across a larger ROI. Using python's geopandas, I can randomly select a subsample of polygons from the layer based on the total number of polygons, but I want to add a condition such that no two polygons in the selection share a boundary edge (corners are OK).
I have two ideas about how to do this, but need some help implementing either one.
Take the random subsample, check the whole dataset for if the condition is met, then keep taking new random subsamples until a suitable sample is chosen. (this could be an endless loop or take many iterations depending on the data)
Take the random sample, check each feature in the sample for if the condition is met, then resample individual features which violate the rule until the subsample meets the condition. (seems like a better approach, but I don't know how to make it happen)
import geopandas as gpd #read in shapefile layer grid = gpd.read_file('grid.shp') #take subsample of 25% of squares subsample = grid.sample(n=int(len(grid)*0.25))