Skip to content

Instantly share code, notes, and snippets.

@fhk
Created March 28, 2024 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fhk/57ff696d2f36f2245df361aece9b493d to your computer and use it in GitHub Desktop.
Save fhk/57ff696d2f36f2245df361aece9b493d to your computer and use it in GitHub Desktop.
# Some quick snippets for points to lines
address_df = pd.DataFrame([[0, Point([c for c in h3.cell_to_latlng(h3_8)[::-1]])]], columns=['id', 'geometry'])
address_gdf = gpd.GeoDataFrame(address_df, geometry="geometry", crs="epsg:4326")
gdf = gpd.read_file(
"./data/all_the_data.fgb",
engine="pyogrio", bbox=location_box)
gdf = gdf.to_crs('epsg:3310') # https://epsg.io/3310
print(gdf.sindex)
sjoin = gpd.sjoin_nearest(left_df=address_gdf, right_df=gdf, how="left", max_distance=10000)
sjoin = sjoin.dropna()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment