gedih3.sqlutils#
Functions#
|
|
|
Attach existing ducklake database |
|
Convert a GeoSeries to a list of overlapping H3 cells at the given resolution. |
|
Convert a GeoSeries to an H3 partition filter at the given resolution. |
|
Convert a DuckDB table to a GeoDataFrame. |
|
Load a GeoDataFrame into a DuckDB table. |
Module Contents#
- gedih3.sqlutils.init_duckdb(threads=None, memory_limit=None, temp_directory=None, max_temp_size=None, extension_directory=None)[source]#
- gedih3.sqlutils.attach_ducklake_db(con, name='gedi_dl', dir=None)[source]#
Attach existing ducklake database If dir is not specified, it will be located in GH3_DEFAULT_H3_DIR.
- Once this function is called, the gedi data can be queried using
SELECT … FROM {name}.data
- gedih3.sqlutils.geoseries_to_cells(shp: geopandas.GeoSeries, resolution: int = 3, expand_ring: int = 1)[source]#
Convert a GeoSeries to a list of overlapping H3 cells at the given resolution.
- gedih3.sqlutils.geoseries_to_filter(shp: geopandas.GeoSeries, resolution: int = 3, expand_ring: int = 1)[source]#
Convert a GeoSeries to an H3 partition filter at the given resolution.
'overlap'coverage is exact w.r.t. the cell polygons, but shots are stored under their hierarchy partition, which can overhang the polygon by ~0.18 x edge length (seeintersect_h3_geometries).expand_ringadds grid_disk neighbors so boundary shots stored in a non-overlapping neighbor partition are not silently filtered out; pass 0 to disable.
- gedih3.sqlutils.duck_to_gdf(table, geometry_columns=['geometry'], crs='EPSG:4326') geopandas.GeoDataFrame[source]#
Convert a DuckDB table to a GeoDataFrame. If multiple geometry columns are specified, the first will be set as the active geometry.
- gedih3.sqlutils.gdf_to_duck(con, gdf: geopandas.GeoDataFrame, geometry_columns: List[str] = ['geometry']) duckdb.DuckDBPyRelation[source]#
Load a GeoDataFrame into a DuckDB table.