ST_GeoHash — Return a GeoHash representation (geohash.org) of the geometry.
text ST_GeoHash(
geometry g1)
;
text ST_GeoHash(
geometry g1, integer precision)
;
Return a GeoHash representation (geohash.org) of the geometry. A GeoHash encodes a point into a text form that is sortable and searchable based on prefixing. A shorter GeoHash is a less precise representation of a point. It can also be thought of as a box, that contains the actual point.
The one-parameter variant of ST_GeoHash returns a GeoHash based on the input geometry type. Points return a GeoHash with 20 characters of precision (about enough to hold the full double precision of the input). Other types return a GeoHash with a variable amount of precision, based on the size of the feature. Larger features are represented with less precision, smaller features with more precision. The idea is that the box implied by the GeoHash will always contain the input feature.
The two-parameter variant of ST_GeoHash returns a GeoHash with a requested precision. For non-points, the starting point of the calculation is the center of the bounding box of the geometry.
Availability: 1.4.0
ST_GeoHash will not work with geometries that are not in geographic (lon/lat) coordinates. |
This method supports Circular Strings and Curves