<para>Availability: 1.3.4</para>
<para>Availability: 1.5.0 geography support was introduced.</para>
+ <para>Changed: 2.0.0 support default args and named args.</para>
<para>&Z_support;</para>
</refsection>
<funcsynopsis>
<funcprototype>
<funcdef>text <function>ST_GeoHash</function></funcdef>
- <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>text <function>ST_GeoHash</function></funcdef>
- <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
- <paramdef><type>integer </type> <parameter>precision</parameter></paramdef>
+ <paramdef><type>geometry </type> <parameter>geom</parameter></paramdef>
+ <paramdef choice='opt'><type>integer </type> <parameter>maxchars=full_precision_of_point</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<para>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.</para>
- <para>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.</para>
+ <para>If no <varname>maxchars</varname> 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.</para>
- <para>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.</para>
+ <para>If <varname>maxchars</varname> 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.</para>
<para>Availability: 1.4.0</para>
------------------------------------------------------------------------\r
\r
-- Availability 1.4.0\r
-CREATE OR REPLACE FUNCTION ST_GeoHash(geometry, int4)\r
+-- Changed 2.0.0 to use default args and named args\r
+CREATE OR REPLACE FUNCTION ST_GeoHash(geom geometry, maxchars int4 DEFAULT 0)\r
RETURNS TEXT\r
AS 'MODULE_PATHNAME', 'ST_GeoHash'\r
LANGUAGE 'C' IMMUTABLE STRICT;\r
\r
--- Availability 1.4.0\r
-CREATE OR REPLACE FUNCTION ST_GeoHash(geometry)\r
- RETURNS TEXT\r
- AS 'SELECT ST_GeoHash($1, 0)'\r
- LANGUAGE 'SQL' IMMUTABLE STRICT;\r
-\r
------------------------------------------------------------------------\r
-- OGC defined\r
------------------------------------------------------------------------\r
DROP FUNCTION IF EXISTS st_hasbbox(geometry);
DROP FUNCTION IF EXISTS cache_bbox();
DROP FUNCTION IF EXISTS st_cache_bbox();
+DROP FUNCTION IF EXISTS ST_GeoHash(geometry); -- changed to use default args
DROP FUNCTION IF EXISTS st_length(geography); -- this one changed to use default parameters
DROP FUNCTION IF EXISTS st_perimeter(geography); -- this one changed to use default parameters
DROP FUNCTION IF EXISTS transform_geometry(geometry,text,text,int);