jgrss / geosample

Spatially balanced sampling with Generalized Random Tessellation Stratified (GRTS)
MIT License
21 stars 4 forks source link

doesn't work on geopandas dataframe #1

Open Daniel-Trung-Nguyen opened 2 years ago

Daniel-Trung-Nguyen commented 2 years ago

I am running this example and nothing showed up. shape file is here:

from geosample import QuadTree
import geopandas as gpd
cea_file = 'BTHD_CEAs_cleaned2.shp'
samples = gpd.read_file(cea_file)
qt = QuadTree(samples.iloc[0:1])
# Split until the quadrants are less than 5,000 meters
qt.split_recursive(max_length=5000)
# Get the actual quadrant length
# qt.qlen
# Get the quadrants as a GeoDataFrame
df = qt.to_frame()
# Get 5 random points using the Generalized Random Tessellation Stratified (GRTS) method
dfs = qt.sample(n=5)
jgrss commented 1 year ago

Hi @Daniel-Trung-Nguyen are you able to share an example of your data?