Why not ask your question on the new OpenStreetMap Community Forum?

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

asked 10 Feb '13, 19:45

Sadeer's gravatar image

accept rate: 0%

edited 10 Feb '13, 19:55

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).

(10 Feb '13, 20:12) RM87

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.

(10 Feb '13, 20:24) 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

permanent link

answered 11 Feb '13, 12:01

sanser's gravatar image

accept rate: 5%

Everything about routing or similar aims based on OSM data is collected in the OSM wiki about Routing.

Search for opensource solutions to implement something in your project.

permanent link

answered 11 Feb '13, 12:29

stephan75's gravatar image

accept rate: 6%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Feb '13, 19:45

question was seen: 12,140 times

last updated: 11 Feb '13, 12:29

powered by OSQA