ST_GeoHash — Return a GeoHash representation (geohash.org) of the geometry.
text ST_GeoHash(
geometry geom, integer maxchars=full_precision_of_point)
;
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.
If no maxchars
is specficified ST_GeoHash returns a GeoHash based on full precision of 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.
If maxchars
is specified ST_GeoHash returns a GeoHash with at most that many characters so a possibly lower precision representation of the input geometry. 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