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 15:36:20 |
Message-ID: | 41601C74.2040501@sympatico.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I agree, NS or EW long lat should be the same.
I was just pointing to the wrong figure. Also, if ll_to_earth takes lat
first, it should report an error for a |lat| > 90...
Michael Fuhr wrote:
> On Sat, Oct 02, 2004 at 09:29:16PM -0400, Jean-Luc Lachance wrote:
>
>>Maybe it would work with the right long & lat...
>>try
>>Protland OR -122.67555, 45.51184
>>Seattle WA -122.32956, 47.60342
>
>
> It doesn't matter which hemisphere the longitudes are in as long
> as they're in the same hemisphere:
>
> test=> select earth_distance(ll_to_earth('122.55688','45.513746'),ll_to_earth('122.396357','47.648845'));
> earth_distance
> ------------------
> 128862.563227506
> (1 row)
>
> test=> select earth_distance(ll_to_earth('-122.55688','45.513746'),ll_to_earth('-122.396357','47.648845'));
> earth_distance
> ------------------
> 128862.563227506
> (1 row)
>
> What *does* matter is that one specify (lat, lon) instead of
> (lon, lat):
>
> test=> select earth_distance(ll_to_earth('45.513746', '122.55688'),ll_to_earth('47.648845', '122.396357'));
> earth_distance
> ------------------
> 237996.256627247
> (1 row)
>
> That's 238km, or about 148mi; using your coordinates gives almost
> the same answer, about 234km or 146mi. As I said, the distance
> between Portland and Seattle is around 150mi.
>
>
>>Also, do not forget that it is the line distance not the driving distance.
>
>
> I doubt anybody thought that earth_distance() was calculating driving
> distance. How would it know what route to follow without an extensive
> road database and a route specification?
>
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2004-10-03 15:53:12 | Re: Out of memory errors on OS X |
Previous Message | Chris Mair | 2004-10-03 15:29:01 | Re: earthdistance results seem to be wrong. |