Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 25, 2011 at 9:47 AM, Carlo Stonebanks <stonec.register@xxxxxxxxxxxx> 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@xxxxxxxxx


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux