Calculating driving distance can be useful in location analysis and e-commerce. If you are 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.
EMPLOYEE NAME |
CURRENT OFFICE COMMUTE (MINUTES) |
POTENTIAL OFFICE 1 | TIME DIFFERENCE | POTENTIAL OFFICE 2 | TIME DIFFERENCE |
Dave | 25 | 34 | +9 | 13 | -12 |
Dev | 38 | 20 | -18 | 34 | -4 |
DeAndra | 64 | 68 | +4 | 54 | -10 |
Derek | 12 | 29 | +17 | 22 | +10 |
Dinesh | 45 | 54 | +9 | 17 | +28 |
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 A>B drive times to multiple potential destinations need to be listed.
Driving distance matrix API
The Google driving distance matrix API provides calculations from many origins to many destinations as a service. Google calculate travel distance and travel time for a matrix of origins and destinations. In July 2018, Google introduced a new pricing model. 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.
Example
The image below shows the distance from Montgomery, Alabama to the 16 nearest Walmart stores. This example would be considered a query. Calculating time and distance 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–100,000 | 100,001–500,000 | 500,000+ | 0–100,000 | 100,001–500,000 | 500,000+ | |
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) |
Contact sales |
Google has a price calculator here, but here's a quick guide on how their monthly pricing stacks up:
DISTANCE MATRIX API | DISTANCE MATRIX ADVANCED | |||||
Number of elements | Calculation | Price | Number of elements | Calculation | Price | |
100,000 | 100,000 x 0.005 | $500 | 100,000 | 100,000 x 0.01 | $1000 | |
200,000 | 100,000 x 0.005 100,000 x 0.004 |
$900 | 200,000 | 100,000 x 0.01 100,000 x 0.008 |
$1800 | |
300,000 | 100,000 x 0.005 200,000 x 0.004 |
$1300 | 300,000 | 100,000 x 0.01 200,000 x 0.008 |
$2600 | |
400,000 | 100,000 x 0.005 300,000 x 0.004 |
$1700 | 400,000 | 100,000 x 0.01 300,000 x 0.008 |
$3400 | |
500,000 | 100,000 x 0.005 400,000 x 0.004 |
$2600 | 500,000 | 100,000 x 0.01 400,000 x 0.008 |
$4200 |
What is the alternative?
Our TravelTime Search API has a feature called 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. If you are based in the UK or Ireland there is also Time Filter [Fast], which can return 100,000 points for an arrival search. Here is a comparison pricing table:
TRAVELTIME PLATFORM (PRICE PER SEARCH) |
|||
0–10,000 | 10,001–60,000 | 60,001-160,000 | 160,000+ |
£0.01 GBP | £0.009 GBP | £0.008 GBP | £0.007 GBP |
A single search costs the same amount, regardless of the number of elements. 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 query.
We use the example from earlier that says each user returns an average of 16 destinations every time they search. How many searches can be done for this price? (please not the TravelTime Search API is priced in GDP but Google's API is priced in USD).
TRAVELTIME PLATFORM |
|||
Number of searches | Calculation | Price | If every user returns 16 destinations, how many searches for this price? |
100,000 | 10,000 x £0.01 50,000 x £0.009 40,000 x £0.008 |
£870 | 100,000 |
200,000 | 10,000 x £0.01 50,000 x £0.009 100,000 x £0.008 40,000 x £0.007 |
£1,630 | 200,000 |
300,000 | 10,000 x £0.01 50,000 x £0.009 100,000 x £0.008 140,000 x £0.007 |
£2,330 | 300,000 |
400,000 | 10,000 x £0.01 50,000 x £0.009 100,000 x £0.008 140,000 x £0.007 |
£3,030 | 400,000 |
500,000 | 10,000 x £0.01 50,000 x £0.009 100,000 x £0.008 340,000 x £0.007 |
£3,730 | 500,000 |
How does it work?
To use the TravelTime Search 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 Search API, this counts as one query.
You can also integrate the TravelTime Search API into your existing app. Read the tutorial on distance matrixes to get started.
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 Search 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 Search 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
- Geocoding and routing are included within the TravelTime Search API
- 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