Skip to content

Instantly share code, notes, and snippets.

View ericmanning's full-sized avatar

Eric Manning ericmanning

  • Princeton, NJ
View GitHub Profile
@ericmanning
ericmanning / ST_GeoHashNeighbors.sql
Created March 2, 2024 01:38 — forked from geozelot/ST_GeoHashNeighbors.sql
PostgreSQL/PostGIS - Grid-based derivation of (8) neighborhood cells for a given GeoHash identifier.
/*
* @in_params
* center_hash - GeoHash identifier to find adjacent cells for
*
* @out_params (column description)
* hash - GeoHash identifier for this adjacent cell
* centroid - Centroid geometry (POINT) for this adjacent cell
* bound - Cell bounds geometry (POLYGON) for this adjacent cell
*
* The function returns a SETOF RECORD containing the 8 direct