[OSM-newbies] Distance between two nodes

Peter Childs pchilds at bcs.org
Mon May 4 17:15:30 BST 2009


2009/5/4 Fabrizio Carrai <fabrizio.carrai at gmail.com>:
> Have a look at http://jan.ucc.nau.edu/~cvm/latlongdist.html
> There is also the code of the simple calculation you need.
> Of course, this is valid for a way linking two nodes. If the distance you
> want to measure is made of several elementar ways, you have to sum of all
> the lengths.
> Hope this is what you asked for.
> Fabrizio
>
> 2009/5/4 Peter Childs <pchilds at bcs.org>
>>
>> I'm probably being completely stupid, But....
>>
>> How do I find the distance between two nodes or indeed the length of a
>> way. Ideally in miles or km.
>>
>> Sounds simple but I can't find a simple answer, and the ones I can
>> find don't seam to come up with the right answer.....
>>
>> Thanks in advance
>>
>> Peter.
>>
>> _______________________________________________
>> newbies mailing list
>> newbies at openstreetmap.org
>> http://lists.openstreetmap.org/listinfo/newbies
>
>
> _______________________________________________
> newbies mailing list
> newbies at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/newbies
>
>

Hmm Short answer.. There is not one.; due to the fact that the earth
is not a sphere.

For speed many of the route find code uses Pythagoras and ignores real units.

There are about 3 different formulas in current use most of which
depend upon the radius of the planet; Vincenty, Haversine, and
spherical law of cosines they are various degrees of accuracy
depending on where you are.

See http://www.movable-type.co.uk/scripts/latlong.html

Peter Childs




More information about the newbies mailing list