duckdb / duckdb_spatial

MIT License
483 stars 39 forks source link

Feature request : a new ST_quadkey() function #201

Closed ericemc3 closed 11 months ago

ericemc3 commented 11 months ago

To enable faster ST_within queries ST_quadkey(long, lat, zoom_level) would allow to add a quadkey column in a geospatial column, that could be used with something like: WHERE quadkey LIKE '03202333%

ref : https://cloudnativegeo.org/blog/2023/10/the-admin-partitioned-geoparquet-distribution/

RaczeQ commented 11 months ago

You can try to utilize the H3 DuckDB extension https://github.com/isaacbrodsky/h3-duckdb instead of quadkeys. It's just another spatial index.

ericemc3 commented 11 months ago

You can try to utilize the H3 DuckDB extension https://github.com/isaacbrodsky/h3-duckdb instead of quadkeys. It's just another spatial index.

This is an interesting information, thank you. Anyway, install h3 doesn't work, and i would appreciate a simple way, for me and people i encourage to use duckdb, to handle spatial indexing without any another extension than the spatial one.

Maxxen commented 11 months ago

Hi! Great idea, I've added an initial function to calculate the quadkey in given a set of coordinates and zoom level in #203. I want to expand more support for this, also add e.g. ST_GeoHash in the future.

ericemc3 commented 11 months ago

Thank you very much for that feature. And i really love the idea of "calculating the smallest possible quadkey that contains a geometry"; can't wait!