From 2475f4f8b4f2f85a8b66b08680820b9c2e4c7f1f Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sun, 1 Jan 2012 15:58:34 +0000 Subject: [PATCH] #961: Change ST_GeoHash to use default args git-svn-id: http://svn.osgeo.org/postgis/trunk@8642 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_output.xml | 13 +++++-------- postgis/postgis.sql.in.c | 9 ++------- postgis/postgis_drop.sql.in.c | 1 + 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/doc/reference_output.xml b/doc/reference_output.xml index fb7db7c49..2e2336664 100644 --- a/doc/reference_output.xml +++ b/doc/reference_output.xml @@ -313,6 +313,7 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3) Availability: 1.3.4 Availability: 1.5.0 geography support was introduced. + Changed: 2.0.0 support default args and named args. &Z_support; @@ -914,12 +915,8 @@ x3dfrag text ST_GeoHash - geometry g1 - - - text ST_GeoHash - geometry g1 - integer precision + geometry geom + integer maxchars=full_precision_of_point @@ -929,9 +926,9 @@ x3dfrag 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. + 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. - 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. + 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 diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index 1acb5f3ed..617e29c89 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -3237,17 +3237,12 @@ CREATE OR REPLACE FUNCTION ST_AsGeoJson(gj_version int4, geom geometry, maxdecim ------------------------------------------------------------------------ -- Availability 1.4.0 -CREATE OR REPLACE FUNCTION ST_GeoHash(geometry, int4) +-- Changed 2.0.0 to use default args and named args +CREATE OR REPLACE FUNCTION ST_GeoHash(geom geometry, maxchars int4 DEFAULT 0) RETURNS TEXT AS 'MODULE_PATHNAME', 'ST_GeoHash' LANGUAGE 'C' IMMUTABLE STRICT; --- Availability 1.4.0 -CREATE OR REPLACE FUNCTION ST_GeoHash(geometry) - RETURNS TEXT - AS 'SELECT ST_GeoHash($1, 0)' - LANGUAGE 'SQL' IMMUTABLE STRICT; - ------------------------------------------------------------------------ -- OGC defined ------------------------------------------------------------------------ diff --git a/postgis/postgis_drop.sql.in.c b/postgis/postgis_drop.sql.in.c index b50e38591..355d42070 100644 --- a/postgis/postgis_drop.sql.in.c +++ b/postgis/postgis_drop.sql.in.c @@ -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); -- 2.50.0