PostGISGeometry Input

ST_GeomFromGeoHash

What is ST_GeomFromGeoHash?

ST_GeomFromGeoHash decodes a GeoHash string and returns the polygon covering its cell, in SRID 4326.

SQL
ST_GeomFromGeoHash(text geohash, integer precision = full)geometry

A shorter GeoHash or lower precision value gives a larger cell; a longer hash gives a smaller, more precise cell.

When would you use ST_GeomFromGeoHash?

Use ST_GeomFromGeoHash to visualise GeoHash-bucketed analytics on a map — converting each hash to a polygon makes it easy to render heat maps, cluster counts, or regional aggregates. It is also helpful when building spatial joins against GeoHash-indexed rows: decode the hash and intersect against source features.

In data-science notebooks, ST_GeomFromGeoHash turns hash identifiers back into map-ready polygons in a single step, with no GeoJSON assembly required.

FAQs

What SRID does the output have?

EPSG:4326. GeoHashes encode WGS84 lat/lon.

What precision does the string give?

Length-dependent: 5 chars ≈ 5 km, 8 chars ≈ 40 m, 12 chars ≈ 3 cm.

How is it different from ST_Box2dFromGeoHash?

ST_GeomFromGeoHash returns a proper polygon geometry; ST_Box2dFromGeoHash returns a lightweight Box2D without SRID.

Can I aggregate hashes and render?

Yes — group by hash, compute aggregate metrics, then convert to geometry for rendering or further spatial joins.