Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST API for driving distance?

Tags:

maps

api

Is there a service that will give me the driving distance between two addresses? Apparently Google Maps API requires you to display a map, which I don't want to do (on that particular page), and I'd like to just snag the data and save it to my DB after a user submits a form, rather than waiting for JS to do it's thing.


If it's relevant, this is going into a Django app. I discovered that CloudMade offers a Python API, which is nice, except their latest dev release has a bug in it (can't use the API object), but more importantly, it's support for Canada is awful (couldn't find directions from any major city around here!).

like image 329
mpen Avatar asked Feb 19 '10 02:02

mpen


People also ask

Does Google Maps have a REST API?

It is designed to work on both mobile devices as well as traditional desktop browser applications. The API includes language localization for over 50 languages, region localization and geocoding, and has mechanisms for enterprise developers who want to utilize the Google Maps API within an intranet.

Is Google distance matrix API free?

The Distance Matrix API uses a pay-as-you-go pricing model.

Can Google Maps API calculate distance between two points?

The API returns information based on the recommended route between start and end points. You can request distance data for different travel modes, request distance data in different units such kilometers or miles, and estimate travel time in traffic.


2 Answers

MapQuest's Directions API is HTTP Querystring based (I'm not sure if it's entirely RESTful). Can get XML or JSON response. Just need to send it an HTTP GET Request.

http://developer.mapquest.com/web/products/open/directions-service

Use the "distance" response parameter.

like image 168
Neil McGuigan Avatar answered Oct 23 '22 20:10

Neil McGuigan


I don't have a high enough reputation on SO to comment on an answer but I just wanted to be clear that contrary to the voted correct answer, Google Directions API has to adhere to the Google Maps API. If you scroll down the supplied link, you will see:

Note: the Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without displaying a map for which directions data was requested is prohibited. Additionally, calculation of directions generates copyrights and warnings which must be displayed to the user in some fashion. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.

like image 35
seePatCode Avatar answered Oct 23 '22 20:10

seePatCode