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

Поиск
Список
Период
Сортировка
От Rick Genter
Тема Re: Miidpoint between two long/lat points? (earthdistance?)
Дата
Msg-id BANLkTik71UdWvZeiM786CjTPwK=LLU2hpg@mail.gmail.com
обсуждение исходный текст
Ответ на Miidpoint between two long/lat points? (earthdistance?)  (Carlo Stonebanks <stonec.register@sympatico.ca>)
Список pgsql-general
On Wed, May 25, 2011 at 9:47 AM, Carlo Stonebanks <stonec.register@sympatico.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.genter@gmail.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Carlo Stonebanks
Дата:
Сообщение: Miidpoint between two long/lat points? (earthdistance?)
Следующее
От: Geoffrey Becker
Дата:
Сообщение: Connecting to Postgres using Windows 7