Skip to content
DuckDB community extension

pintail

Lightweight Geohash utilities for DuckDB, including coordinate and geometry encoding, cell decoding, bounding boxes, and neighbors.

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL pintail FROM community;
LOAD pintail FROM community;

Try it in a temporary SQL session with pintail already loaded. Queries run in this tab; examples using files or services need their own setup.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Recommended: GEOMETRY coordinates use longitude, latitude.

SQL
-- Recommended: GEOMETRY coordinates use longitude, latitude.
SELECT st_geohash('POINT(121.4737 31.2304)'::GEOMETRY, 6);
-- wtw3sj

Provided by tshelianthus. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

Pintail provides dependency-free Geohash utilities for DuckDB. New support references PostGIS documentation and behavior, with Pintail-specific API choices. Encode points, lines, polygons, multi-geometries, and collections using a Geohash cell that covers the entire geometry. GEOMETRY input is recommended for new queries and uses longitude, latitude; existing numeric calls retain latitude, longitude order.

Decode Geohashes to cell-center POINTs, cell-boundary POLYGONs, or bounding-box STRUCTs, and find the eight neighboring cells. st_box2dfromgeohash is an alias of st_geohash_bbox and returns the same STRUCT. Function signatures, descriptions, and examples are available through duckdb_functions().

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
tshelianthus/duckdb-pintail
License
Apache-2.0
Maintainers
tshelianthus
Written in
C++
Build source
59ff51b7589b
Build definition
Community descriptor