Re: Making small bits of code available

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Making small bits of code available
Date: 2002-09-07 12:01:01
Message-ID: 20020907120101.GA28944@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Fri, Sep 06, 2002 at 09:58:00 -0400,
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
>
> /contrib/earthdistance already exists. Is this new functionality?

This works with cube instead of point. If you use point hold latitude and
longitude you have to worry about whether you will have data near 180
degrees of longitude or near the poles. This may not be a problem if
your data is mostly on one continent.

The script I have is most grant calls for the cube functions. Since cube
needs to be installed as postgres (or other super user), most likely
you want to grant execute to public on the provided functions. (I don't
know if you need to do this for ones just used be the gist stuff.)

The stuff people might want to see are a few sql functions for getting
to and from latitude and longitude and cube (as domain earth) and some
functions related to getting the size of boxes to use for searching for
points within a great circle distance of a specified point.

If 5K isn't too much I could post it to the list and it will get archived
and people that are interested can find it with google and can take what they
want from the code.

This stuff isn't packaged up neatly for a contrib with a regression test
and all. Probably people who use this will want to tinker with it before
using it themselves.

The function prototypes extracted from the file are:
create function earth() returns float8 language 'sql' immutable as
create function sec_to_gc(float8) returns float8 language 'sql'
create function gc_to_sec(float8) returns float8 language 'sql'
create function ll_to_earth(float8, float8) returns earth language 'sql'
create function latitude(earth) returns float8 language 'sql'
create function longitude(earth) returns float8 language 'sql'
create function earth_distance(earth, earth) returns float8 language 'sql'
create function earth_box(earth, float8) returns cube language 'sql'

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2002-09-07 13:36:47 SQL: how to find if a table exists?
Previous Message Joel Rodrigues 2002-09-07 09:19:45 Fwd: "...integer[] references..." = error

Browse pgsql-hackers by date

  From Date Subject
Next Message Masaru Sugawara 2002-09-07 12:41:43 About connectby()
Previous Message ljguo_1234 2002-09-07 08:18:03 Operator startegies for an access method