Calculating driving distance can be useful in location analysis and e-commerce. If you're planning on relocating offices, for example, you could calculate the distance from the potential offices to each employees address. This kind of analysis can help you make an informed decision about which location to choose.
Below is an example of staff commute times to two potential offices.
CURRENT OFFICE COMMUTE (MINUTES)
|POTENTIAL OFFICE 1||TIME DIFFERENCE||POTENTIAL OFFICE 2||TIME DIFFERENCE|
You can also use drive time calculations to help your customers make decisions. A store finder page can help customers decide which location is easier for them to get to using a distance matrix.
Determining drive times to many points of interest involves multiple calculations. This is because drive times to multiple potential destinations need to be calculated.
Driving distance matrix API
The Google driving distance matrix API provides calculations from many origins to many destinations as a service. Google calculates the distance and time for a matrix of origins and destinations using this API.
Conducting a search from a single origin to multiple destinations is called a query. Within that query are multiple origin-destination pairs, these are the number of searches from the point of origin to multiple destination points. Each one of these pairs is called an element. So, if there is a single start point and 10 destinations, this equates to 10 origin-destination pairs, or elements.
The image below shows the distance from Montgomery, Alabama to the 16 nearest Walmart stores. This example would be considered a query. Calculating times and distances from the origin (Montgomery) to the 16 possible stores would be calculated as 16 elements.
Using the pricing effective from July 16, 2018 this single search would cost $0.08 using the standard distance matrix API. It would cost $0.16 if using distance matrix advanced. Google billing here. The differences between the two costs are:
- Distance matrix API can calculate driving using
- Best guess: estimates the best guess drive time based on historical data
- Pessimistic: uses historical data but assumes the traffic conditions are bad
- Optimistic: uses historical data but assumes the traffic conditions are good
- Distance matrix advanced can use live traffic data to give a more accurate estimation of drive times. The user must add a departure time that is either now or some time in the future.
|DISTANCE MATRIX API
MONTHLY VOLUME RANGE
(Price per element)
|DISTANCE MATRIX ADVANCED
MONTHLY VOLUME RANGE
(Price per element)
|0.005 USD per each
(5.00 USD per 1000)
|0.004 USD per each
(4.00 USD per 1000)
|Contact sales||0.01 USD per each
(10.00 USD per 1000)
|0.008 USD per each
(8.00 USD per 1000)
Google pricing is listed hereWhat is the alternative?
The TravelTime API has a feature called Distance Matrix Time Filter - an alternative to Google’s driving distance matrix API. You are charged per query (we call this a search), instead of per element.
Time Filter allows you to conduct a search from a single origin to 2,000 possible destinations in a single query. There is also Time Filter [Fast], which can return 100,000 points for an arrival search.
For example, the image below shows a property search using the TravelTime API. Although there are 692 potential properties, this would be considered a single search.
Here's a walk through of costs assuming each user returns an average of 16 destinations every time they search. Please note the TravelTime Search API is priced in GBP but Google's API is priced in USD.
How does it work?
To use the TravelTime API you would enter:
- Your starting destination
- Your maximum travel time
- Your preferred mode of transport
The Time Filter endpoint would calculate the travel times from the origin to each point of interest.
Additionally, the Time Map endpoint can calculate areas that could be reached within that travel time. For example show me all locations that I can reach within 30 minutes. It then returns a shape called an isochrone. Each point on the perimeter of the isochrone is equal the maximum travel time.
The example below shows where can be reached within 30 minutes drive from central London.
Using the demo page example, you can then search for points of interest using Time Filter. The example below uses Foursquare to show cinemas that can be reached within 30 minutes drive from central London.
There are 50 results returned in total. This would be 50 elements using the Google driving distance matrix API, but using the TravelTime API, this counts as one search.
You can also integrate the TravelTime API into your existing app.
Key feature differences
Number of travel times calculated in 1 request:
- Google Distance Matrix API can calculate up to 25 origins or 25 destinations in 1 request.
- TravelTime API can calculate from 1 origin up to 100,000 points in 1 request using 'fast' feature, or 2,000 using the standard search
- Google has no dedicated time map output feature
- The TravelTime API returns a JSON response with coordinates for points showing the boundaries of zones reachable within a corresponding travel time.
- Google has separate APIs to return routing information and geocoding, these have a different pricing model.
- Geocoding and map tiles are included within the TravelTime Search API paid plan free.
- Google's distance matrix can calculate drive speeds using optimistic, pessimistic & best guess
- Live traffic times are taken into account using the Google Distance Matrix advanced feature
- Drive time calculations use a single road speed average using the TravelTime Search API and are not charged differently