Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a tool to find the distance between two points whose longitude and latitude are given. I am making an application so it will require bulk queries, so i cannot use google maps distance matrix API that could tell me the distance via road, airways or any other. So I turned up to OSM data, i downloaded the OSM data and then pgrouting tool. But I am unable to find the distance via road between two points from this data stored in postgres table.

Any help regarding how to fetch this data from the postgresql db or any other resource you know that can accomplish my goal will be greatly appreciated.

share|improve this question
pgRouting requires each road entry to have a start and an end node id. If your dataset already contains this information, you can skip this step. Otherwise we will create the node ids now -… credit to @underdark – Mapperz Jun 19 '12 at 21:11
CAn you project the point to the nearest line and use the projection for mapping? – dassouki Aug 30 '12 at 23:38

OSM has a page dedicated to routing, which is worth going over:

There is a special tool for importing OSM data into a PGRouting system and generating the required structure:

Lastly, there is a workshop tutorial on getting routing working with OSM data here:

share|improve this answer

You can use GraphHopper for this task. Have a look into the documentation for more information.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.