]> granicus.if.org Git - postgis/commitdiff
#961: Change ST_GeoHash to use default args
authorRegina Obe <lr@pcorp.us>
Sun, 1 Jan 2012 15:58:34 +0000 (15:58 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 1 Jan 2012 15:58:34 +0000 (15:58 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8642 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_output.xml
postgis/postgis.sql.in.c
postgis/postgis_drop.sql.in.c

index fb7db7c49902aff871c736c9ecf152a88d3d7561..2e23366643d2e92b87d3cd63d7fa3eb174a3cbfa 100644 (file)
@@ -313,6 +313,7 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3)
 
                        <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>
 
@@ -914,12 +915,8 @@ x3dfrag
                <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>
@@ -929,9 +926,9 @@ x3dfrag
 
                <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>
 
index 1acb5f3ed9c4c119db9828e3005b80682c29cf64..617e29c892b5234287ca32c2c56c0a5c375f0eee 100644 (file)
@@ -3237,17 +3237,12 @@ CREATE OR REPLACE FUNCTION ST_AsGeoJson(gj_version int4, geom geometry, maxdecim
 ------------------------------------------------------------------------\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
index b50e38591c9e2599fdebc28cd239ccf4e0605239..355d42070bf45858160f6688631cead5c1252126 100644 (file)
@@ -84,6 +84,7 @@ DROP FUNCTION IF EXISTS st_dropbbox(geometry);
 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);