diff options
| author | Bruce Momjian <bruce@momjian.us> | 2002-09-20 03:47:22 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2002-09-20 03:47:22 +0000 |
| commit | 24bebf0b725e965ed2b725dcb31a46f787e98dbf (patch) | |
| tree | aeb3840f27e8cadf46d516ed1227c8916f746955 /contrib/earthdistance/earthdistance.sql.in | |
| parent | a834cbe1e91f496145373b18014e181e15cbd0d5 (diff) | |
| download | postgresql-24bebf0b725e965ed2b725dcb31a46f787e98dbf.tar.gz | |
I have included fixes to declare some floating point constants as double
instead of int, change the calculation method to use the haversine
formula
which is more accurrate for short distances, added a grant to public for
geo_distance and added a regression test.
I will resubmit the earth distance stuff based on cube after 7.3 is
released.
Bruno Wolff III
Diffstat (limited to 'contrib/earthdistance/earthdistance.sql.in')
| -rw-r--r-- | contrib/earthdistance/earthdistance.sql.in | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/earthdistance/earthdistance.sql.in b/contrib/earthdistance/earthdistance.sql.in index 087484da51..04485589c7 100644 --- a/contrib/earthdistance/earthdistance.sql.in +++ b/contrib/earthdistance/earthdistance.sql.in @@ -1,16 +1,12 @@ +begin; --------------- geo_distance -DROP FUNCTION geo_distance (point, point); -CREATE FUNCTION geo_distance (point, point) RETURNS float8 - AS 'MODULE_PATHNAME' LANGUAGE 'c' - WITH (isstrict); - -SELECT geo_distance ('(1,2)'::point, '(3,4)'::point); +CREATE OR REPLACE FUNCTION geo_distance (point, point) RETURNS float8 + LANGUAGE 'c' IMMUTABLE STRICT AS 'MODULE_PATHNAME'; --------------- geo_distance as operator <@> -DROP OPERATOR <@> (point, point); CREATE OPERATOR <@> ( leftarg = point, rightarg = point, @@ -18,7 +14,11 @@ CREATE OPERATOR <@> ( commutator = <@> ); --- ( 87.6, 41.8) is in Chicago --- (106.7, 35.1) is in Albuquerque --- The cities are about 1100 miles apart -SELECT '(87.6,41.8)'::point <@> '(106.7,35.1)'::point; +-- +-- By default this function is made executable by anyone. To restrict +-- access by default, comment out the following grant command. +-- + +grant execute on function geo_distance(point, point) to public; + +commit; |
