ST_GeoHash — Gibt die Geometrie in der GeoHash Darstellung aus.
text ST_GeoHash(
geometry geom, integer maxchars=full_precision_of_point)
;
Computes a GeoHash representation of a geometry. A GeoHash encodes a geographic 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 be thought of as a box that contains the point.
Non-point geometry values with non-zero extent can also be mapped to GeoHash codes. The precision of the code depends on the geographic extent of the geometry.
If maxchars
is not specified, the returned GeoHash code is for the smallest cell containing the input geometry. Points return a GeoHash with 20 characters of precision (about enough to hold the full double precision of the input). Other geometric types may return a GeoHash with less precision, depending on the extent of the geometry. Larger geometries are represented with less precision, smaller ones with more precision. The box determined by the GeoHash code always contains the input feature.
If maxchars
is specified the returned GeoHash code has at most that many characters. It maps to 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.
Verfügbarkeit: 1.4.0
ST_GeoHash requires input geometry to be in geographic (lon/lat) coordinates. |
This method supports Circular Strings and Curves.
SELECT ST_GeoHash( ST_Point(-126,48) ); st_geohash ---------------------- c0w3hf1s70w3hf1s70w3 SELECT ST_GeoHash( ST_Point(-126,48), 5); st_geohash ------------ c0w3h -- This line contains the point, so the GeoHash is a prefix of the point code SELECT ST_GeoHash('LINESTRING(-126 48, -126.1 48.1)'::geometry); st_geohash ------------ c0w3