From: | Jean-Luc Lachance <jllachan(at)sympatico(dot)ca> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, mike cox <mikecoxlinux(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: earthdistance is not giving correct results. |
Date: | 2004-10-03 01:29:16 |
Message-ID: | 415F55EC.4080909@sympatico.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Maybe it would work with the right long & lat...
try
Protland OR -122.67555, 45.51184
Seattle WA -122.32956, 47.60342
Also, do not forget that it is the line distance not the driving distance.
Michael Fuhr wrote:
> On Sat, Oct 02, 2004 at 07:09:25PM -0400, Tom Lane wrote:
>
>>mike cox <mikecoxlinux(at)yahoo(dot)com> writes:
>>
>>>The distance from Portland to Seattle is not 128862
>>>miles.
>>
>>How about 128.8 kilometers? The earthdistance docs say it's in meters
>>unless you've redefined the base unit.
>
>
> 128.8 kilometers is about 80 miles; the distance from Portland to
> Seattle is more like 150 miles.
>
>
>>>earth_distance(ll_to_earth('122.55688','45.513746'),ll_to_earth('122.396357','47.648845'));
>
>
> I haven't played with earthdistance, but I'd guess that the arguments
> to ll_to_earth should be (latitude, longitude) instead of (longitude,
> latitude).
>
> Here are some queries from my own implementation of the haversine
> function, which is another way to measure distances on a sphere:
>
> => select haversine(122.55688, 45.513746, 122.396357, 47.648845);
> haversine
> ------------------
> 79.9258188445352
>
> That distance is miles, which is almost exactly equivalent to the
> 128.8km figure from earth_distance(). Correcting the order of the
> arguments gives this:
>
> => select haversine(45.513746, 122.55688, 47.648845, 122.396357);
> haversine
> ------------------
> 147.614987754694
>
> That's more like the true distance in miles between Portland and
> Seattle
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2004-10-03 02:08:02 | Re: earthdistance is not giving correct results. |
Previous Message | Christopher Browne | 2004-10-03 01:26:36 | Re: VACUUM FULL on 24/7 server |