Re: earthdistance is not giving correct results.
От | Jean-Luc Lachance |
---|---|
Тема | Re: earthdistance is not giving correct results. |
Дата | |
Msg-id | 41601C74.2040501@sympatico.ca обсуждение исходный текст |
Ответ на | Re: earthdistance is not giving correct results. (Michael Fuhr <mike@fuhr.org>) |
Ответы |
Re: earthdistance is not giving correct results.
|
Список | 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? >
В списке pgsql-general по дате отправления: