The title pretty much says it all. Is there an accurate method to calculate the distance of an OSM way?
asked
Sadeer |

For any consecutive points P1(lat1,lon1), P2(lat2,lon2) in a "way" calculate the corresponding P1(x1,y1,z1), P2(v2,y2,z2) and so calculate the cetral angle "alpha" in the corresponding main circle (use the scalar or vector product of the 2 position vectors). The diatnce is then dist=alpha*R (R, the major semi-axis of the WGS'84 sphere). You can find many related articles by searching, for example using "latitude longitude distance" key-words, like the following one http://www.movable-type.co.uk/scripts/latlong.html
answered
sanser |

Please add some details like what accuracy do you need. What is your source data? Is it a way id, an osm file or do you have these ways in a database?

Also knowing what you need to do, would help to write a good answer (otherwise you might get a perfectly good formula for calculating the length with pencil and paper).

I'm given an OSM XML file and would like to calculate the distances of the ways in the XML file. It's needed for my academic project which is to implement a routing engine.