Calculate routes + distances automatically - possible with OSM?

Hello everyone!

I want create a little script that automatically calculates routes for multiple, imported adresses and reports the distance.

For example: I have a database with 4 adresses, called A,B,C,D and one destination (calles Z).
Now the script should automatically calculate the Routes A->Z, B->Z, C->Z, D->Z (for a car) and report back the distance for each route.

This is possible with the Google maps API, but due to license restrictions I can not use it.

I skimmed through your wiki and found out, that there are various routers. I tried some of them, but most showed poor results (e.g. didn’t even find the adresses).

I would be very thankful if someone could point me in the right direction here. What tools do I need? Which router would be the best for Germany?

thanks in advance, SPACESHIP

OpenStreetMap does not have consistent good address data. Even the cleverest routing algorithm in the world can’t find 57 Frog Street if no-one has tagged Frog Street with house numbers in OSM.

So if you want a complete addressing solution, you’re better off looking elsewhere. The well-known Skobbler routing software, for example, uses OpenStreetMap for routing but Google for addressing.

If, however, you’re happy to sacrifice addressing quality, try looking at yournavigation, MapQuest’s Open API, and CloudMade as good quality routers.

There are a number of opensource routing engines that work with OSM data, Gosmore for instance is good and versatile. But, as Richard pointed out, we’re still missing a lot (well, nearly all) addresses. So if you have a private or other source that can convert an address to a point on the map then OSM has the streetnetwork information and the routing software. Most routing engines are capable of communicating using the commandline and are therefore extremely easy to integrate with scripts.

If you are satisfied with only routing to the street in question (not the housenumber, but just the street) then OSM is all you need.

Have a look at

Is that helpful for you?

Thank you all for you answers and I’m sorry that I couldn’t reply any sooner.

Routing to the street would be enough.
I tried the routers that Richard suggested but as far as I could find out only MapQuest Open Directions Service allows me to implement it into a script.
The problem here is, that the MapQuest Open doesn’t seem to allow adresses, it only uses longitude/latitude coordinates.

The perfect thing for me would be a simple way to give the router my start and my end adress and then he returns the distance as response.

I’d be thankful for any ideas?

I can give you only just one more hint to look at: (Maybe you have been there already …) … and there the lists for online or offline routing.

Hello everyone!
As part of my PhD research, I need to find the driving distance between origin-destination pairs based on longitude-latitude data that I have. Due to the large number of elements (about 1,500,000) and considering the time constraint of project, I cannot use the free version of Google Map API which gives me at most 2500 elements per day.

I’m wondering if I can use any of OSM APIs for doing this? and if there is a limitation on the number of queries per day?

Thanks in advance

The key word you need is “batch geocoding” … do a search for this on and you will find some more hints about that.

Although our route planner website interface uses GM, our route optimization API is fully OSM based. It can also be used for distance matrices up to 150 points at a time. The number of queries is “unlimited”, but with a fair-use policy and rate-limited to one at a time.