Re: Miidpoint between two long/lat points? (earthdistance?)

From: Rick Genter <rick(dot)genter(at)gmail(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Miidpoint between two long/lat points? (earthdistance?)
Date: 2011-05-25 16:59:33
Message-ID: BANLkTik71UdWvZeiM786CjTPwK=LLU2hpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 25, 2011 at 9:47 AM, Carlo Stonebanks <
stonec(dot)register(at)sympatico(dot)ca> wrote:

> I need to calculate the long/lat values between a line demarcated by two
> long/lat points.
>
>
>
> The points will be very close, but there is the 180 degree problem to
> consider, so a simple average won’t work.
>
>
>
> Does anyone know of a function or have a formula that will work using geo
> long/lat values? I don’t see anything obvious in the earthdistance module.
>

The simplest way to deal with "the 180 degree problem" is to remember that
you can add 360 degrees to a long and get a value that should continue to
work. So, assuming "West" is negative, -175 (175 degrees West) is the same
as -175+360 = 185 (185 degrees East). Then you don't have to worry about
wraparound. If the result is > 180, subtract 360.
--
Rick Genter
rick(dot)genter(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2011-05-25 17:58:43 PostgreSQL 8.4.8 bringing my website down every evening
Previous Message Carlo Stonebanks 2011-05-25 16:47:05 Miidpoint between two long/lat points? (earthdistance?)