| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | Jean-Luc Lachance <jllachan(at)sympatico(dot)ca> |
| 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 02:08:02 |
| Message-ID: | 20041003020802.GA26078@winnie.fuhr.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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?
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2004-10-03 03:39:43 | Re: earthdistance is not giving correct results. |
| Previous Message | Jean-Luc Lachance | 2004-10-03 01:29:16 | Re: earthdistance is not giving correct results. |