Lightweight Geohash utilities for DuckDB, including coordinate and geometry encoding, cell decoding, bounding boxes, and neighbors.
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL pintail FROM community;
LOAD pintail;
Example
INSTALL pintail FROM community;
LOAD pintail;
-- Recommended: GEOMETRY coordinates use longitude, latitude.
SELECT st_geohash('POINT(121.4737 31.2304)'::GEOMETRY, 6);
-- wtw3sj
About pintail
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().
Geometry functions use DuckDB Core GEOMETRY without requiring Spatial, GEOS, PROJ, or PostGIS. Decoded geometries carry EPSG:4326 coordinates.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| pintail | scalar | Internal load-path smoke function; returns a Pintail diagnostic string. | NULL | [pintail('load-smoke')] |
| st_box2dfromgeohash | scalar | Decode a Geohash prefix to a BOX2D-compatible latitude/longitude bounding box. | NULL | [st_box2dfromgeohash('ezs42-extra', 5)] |
| st_box2dfromgeohash | scalar | Decode a Geohash to a BOX2D-compatible latitude/longitude bounding box. | NULL | [st_box2dfromgeohash('ezs42')] |
| st_geohash | scalar | Encode a geometry extent as a Geohash with an optional maximum character count. | NULL | [st_geohash('POINT(121.4737 31.2304)'::GEOMETRY, 6)] |
| st_geohash | scalar | Encode latitude and longitude as a standard Geohash Base32 string. | NULL | [st_geohash(31.2304, 121.4737, 6)] |
| st_geohash | scalar | Encode latitude and longitude using the default Geohash precision. | NULL | [st_geohash(31.2304, 121.4737)] |
| st_geohash | scalar | Encode the smallest Geohash cell containing a geometry's complete XY extent. | NULL | [st_geohash('LINESTRING(-126 48, -126.1 48.1)'::GEOMETRY)] |
| st_geohash_bbox | scalar | Decode a Geohash prefix to its latitude/longitude bounding box. | NULL | [st_geohash_bbox('ezs42-extra', 5)] |
| st_geohash_bbox | scalar | Decode a Geohash to its latitude/longitude bounding box. | NULL | [st_geohash_bbox('ezs42')] |
| st_geohash_neighbors | scalar | Return the eight adjacent Geohash cells in [N, NE, E, SE, S, SW, W, NW] order. | NULL | [st_geohash_neighbors('ezs42')] |
| st_geomfromgeohash | scalar | Decode a Geohash prefix to the polygon boundary of its cell. | NULL | [st_geomfromgeohash('c0w3h-extra', 5)] |
| st_geomfromgeohash | scalar | Decode a Geohash to the polygon boundary of its cell. | NULL | [st_geomfromgeohash('c0w3h')] |
| st_pointfromgeohash | scalar | Decode a Geohash prefix to the center point of the selected cell. | NULL | [st_pointfromgeohash('wtw3sj-extra', 6)] |
| st_pointfromgeohash | scalar | Decode a Geohash to the center point of its cell. | NULL | [st_pointfromgeohash('wtw3sj')] |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.