I'm currently developing a web application that will allow the user to enter two addresses (starting address and destination) and show him the distance in km. Actually, I'm using the haversin algorithm but when I enter the addresses in Google Map for example, usually the distance that I calculated is very smaller than the "real" distance (because in real life there are roads, etc). I see that Google provides an API called "distance matrix" but the number of requests is limited for commercial uses unless you pay a licence.

Do you know some free web services that doing the same thing as "distance matrix" for free commercial uses, please?

Thank you a lot!

1 Answer 1


If you have your own server, you could set up and run a private instance of OSRM (Open Source Routing Machine). You can try it in the demo page. On the Github page you can find the API documentation.

Notice that there are alternatives to Google Maps Distance Matrix API:

  • OSRM itself, lets you query router.project-osrm.org. See here.
  • OpenRouteService, lets you query openls.geog.uni-heidelberg.de. See here.

Maybe there are even more. However, I highly doubt that there's one that will let you make intensive use for free (CPU time is never free of charge).

The alternatives I mentioned require that you contact them (and likely pay/sponsor them in some way).

If you want to make intensive use without paying anyone, you should install OSRM and use it as a private insance.

  • Thank you for your reply, I will buy an OVH account, do you know OVH ? (it's a french webhost), dou you think I can install OSRM on their servers ?
    – KhoyaDev
    Jan 21, 2016 at 20:34
  • I guess you can do it. Here you can see how to deploy to EC2 or Heroku (look for "Setup on EC2 or on Heroku"). I think you can use OVH as long as you have access to a command line where you can issue and run commands.
    – William
    Jan 21, 2016 at 20:40
  • Consider, however, that Heroku has a free plan (you have a very strict limit on how much CPU/hour you can use, if I'm not mistaken). It could be a good solution because you could decide to up your plan (buying a subscription) without changing anything. I think EC2 has something like that as well (I think they have a "basic" account free for 1 year). By the way: if you're wondering which service is better, then you can open another question here I think :)
    – William
    Jan 21, 2016 at 20:44
  • Ok, thank you !! Yes I think I'll open another question, but after that the face of my site is completely finished (I have a lot of work lol), and I go all out on OSRM ^^ .
    – KhoyaDev
    Jan 21, 2016 at 21:00
  • Definitely. Remember that it's not "commercial use" if you're just trying out. So, as long as you're developing the website, you can query router.project-osrm.org. When you're finished, you can buy a private instance :)
    – William
    Jan 21, 2016 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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