PostGISGeometry Input

ST_PointFromGeoHash

What is ST_PointFromGeoHash?

ST_PointFromGeoHash decodes a GeoHash and returns the centre point of the cell as a POINT in SRID 4326. An optional precision truncates the hash before decoding.

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

The returned point is the lat/lon centroid of the GeoHash cell.

When would you use ST_PointFromGeoHash?

Use ST_PointFromGeoHash when a GeoHash-indexed dataset should be rendered or queried as points — rendering user check-ins by GeoHash cluster, for instance, or computing great-circle distances between GeoHash locations. The centre point is a sensible default representative coordinate for an entire cell.

For rendering the cell extent, use ST_GeomFromGeoHash to get the polygon instead.

FAQs

What does the output represent?

The centre of the GeoHash cell — the midpoint of the cell's lat and lon ranges.

What SRID is returned?

EPSG:4326.

Does it error on invalid GeoHash?

Yes. Invalid base-32 characters raise an error.

How is it different from ST_GeomFromGeoHash?

ST_GeomFromGeoHash returns a polygon covering the cell. ST_PointFromGeoHash returns just the cell centre as a point.