This guide is aimed at helping a migration from the Google Distance Matrix API, to the Travel Time Matrix (Fast) endpoint.
It covers the main similarities and differences between the two services, covering Features, Request Details, Response Details, and Error Handling.
- Larger matrices (1 million locations per request, vs 100)
- Exceptional performance with no rate limits, even for large requests
- Fixed cost and unlimited usage, instead of transactional pricing
- Comprehensive support included in all licences
The table below covers the main features of the two services.
Feature | Google API | TravelTime API |
---|---|---|
Maximum Matrix Size | 100 elements (and max 25 origins or destinations) | 10 x 100,000 |
Sync / Async | Synchronous | Synchronous |
Performance | Limited to 60,000 elements per minute. | Able to return 100,000 elements in 120 ms, with no rate limit. |
Transport Modes | Driving, Walking, Cycling, Public Transit | Driving, Walking, Cycling, Public Transit |
Calculated Properties | Travel time, Distance | Travel time, Distance |
Pricing | Usage based | Fixed price, unlimited usage |
Endpoint Playground | N/A | playground.traveltime.com/travel-time-distance-matrix-fast |
Support | Monthly fee + % of platform charges (for Enhanced support) | Included in all licences |
The sections below cover the main details of the API requests for each service, including endpoint details, authentication, and request structure.
A side-by-side comparison is provided to show how the same 2x2 matrix can be generated using each service.
Feature | Google API | TravelTime API |
---|---|---|
Base URL | maps.googleapis.com/maps/api/distancematrix | api.traveltimeapp.com/v4/time-filter/fast |
Request Type | GET | POST |
Feature | Google API | TravelTime API |
---|---|---|
Authentication Method | key in query string | X-Application-Id and X-Api-Key headers |
Required Headers | N/A | Content-Type: application/json X-Application-Id: {Your_App_ID} X-Api-Key: {Your_API_Key} |
Feature | Google API | TravelTime API |
---|---|---|
Search Structure | Journeys calculated from all origins to all destinations | Individual one-to-many or many-to-one searches grouped in one request |
Location Format | Separate origins and destinations parameters | Single locations array with IDs |
Location Identifiers | Place ID, Address, Coordinates, Plus codes, Encoded polyline | lat lng |
Configuration | Via additional query string parameters | Via parameters within the request body, which can differ between searches |
Transport Type | mode: driving / walking / bicycling / transit | transportation: { type: driving+ferry / cycling+ferry / walking+ferry / public_transport } |
Time of Day Configuration | departure_time or arrival_time | arrival_time_period: weekday_morning |
Traffic Configuration | traffic_model: best_guess / pessimistic / optimistic | N/A |
Max Travel Time Configuration | N/A | Set with the travel_time parameter, with max value 10,800 (3 hours) |
Result Properties | Not specified in request | Explicitly requested via properties array |
The request examples below both show how to generate the drive times and distances between two origins and two destinations in the UK.
curl -X GET "https://maps.googleapis.com/maps/api/distancematrix/json?origins=51.532131%2C-0.293897%7C51.871461%2C-0.435683&destinations=51.749232%2C-1.258321%7C50.899630%2C-1.011401&arrival_time=1740748800&mode=driving&key={Your_API_Key}"
curl -X POST "https://api.traveltimeapp.com/v4/time-filter/fast" \
-H "Content-Type: application/json" \
-H "X-Application-Id: {Your_App_ID}" \
-H "X-Api-Key: {Your_API_Key}" \
-d '{
"locations": [
{
"id": "Origin 1",
"coords": {
"lat": 51.532131,
"lng": -0.293897
}
},
{
"id": "Origin 2",
"coords": {
"lat": 51.871461,
"lng": -0.435683
}
},
{
"id": "Destination 1",
"coords": {
"lat": 51.749232,
"lng": -1.258321
}
},
{
"id": "Destination 2",
"coords": {
"lat": 50.899630,
"lng": -1.011401
}
}
],
"arrival_searches": {
"one_to_many": [
{
"id": "Origin 1",
"departure_location_id": "Origin 1",
"arrival_location_ids": [
"Destination 1",
"Destination 2"
],
"travel_time": 10800,
"arrival_time_period": "weekday_morning",
"properties": [
"travel_time",
"distance"
],
"transportation": {
"type": "driving"
}
},
{
"id": "Origin 2",
"departure_location_id": "Origin 2",
"arrival_location_ids": [
"Destination 1",
"Destination 2"
],
"travel_time": 10800,
"arrival_time_period": "weekday_morning",
"properties": [
"travel_time",
"distance"
],
"transportation": {
"type": "driving"
}
}
]
}
}
The sections below cover the main details of the API response for each service.
A side-by-side comparison is provided to show how the same 2x2 matrix is returned using each service.
Feature | Google API | TravelTime API |
---|---|---|
Root Elements | destination_addresses origin_addresses rows status | Single results array |
Entry Identification | Implied through relative positions within elements and rows arrays | String IDs (search_id, id ) |
Success / Error Info | status field for each element | Unreachable locations listed in unreachable arrays (one per search) |
Distance Unit Label | text (as text)value (in metres) | distance (in metres) |
Travel Time Unit Label | text (as text)value (in seconds) | travel_time (in metres) |
Additional Data | duration_in_traffic fare | N/A |
The response examples below both show the drive times between two origins and two destinations in the UK.
{
"destination_addresses": [
"2 Cambridge Terrace, Oxford OX1 1TP, UK",
"17 Cotwell Ave, Waterlooville PO8 9AP, UK"
],
"origin_addresses": [
"56 Priory Gardens, London W5 1DY, UK",
"7 Friars Way, Luton LU1 5PR, UK"
],
"rows": [
{
"elements": [
{
"distance": {
"text": "82.2 km",
"value": 82236
},
"duration": {
"text": "1 hour 5 mins",
"value": 3873
},
"status": "OK"
},
{
"distance": {
"text": "117 km",
"value": 116714
},
"duration": {
"text": "1 hour 26 mins",
"value": 5170
},
"status": "OK"
}
]
},
{
"elements": [
{
"distance": {
"text": "109 km",
"value": 108847
},
"duration": {
"text": "1 hour 19 mins",
"value": 4758
},
"status": "OK"
},
{
"distance": {
"text": "143 km",
"value": 142881
},
"duration": {
"text": "1 hour 40 mins",
"value": 6011
},
"status": "OK"
}
]
}
],
"status": "OK"
}
{
"results": [
{
"search_id": "Origin 1",
"locations": [
{
"id": "Destination 1",
"properties": {
"travel_time": 4123,
"distance": 81870
}
},
{
"id": "Destination 2",
"properties": {
"travel_time": 5278,
"distance": 109859
}
}
],
"unreachable": []
},
{
"search_id": "Origin 2",
"locations": [
{
"id": "Destination 1",
"properties": {
"travel_time": 4932,
"distance": 108815
}
},
{
"id": "Destination 2",
"properties": {
"travel_time": 6107,
"distance": 143597
}
}
],
"unreachable": []
}
]
}
The TravelTime API uses standard http status codes, such as 503 Service Unavailable and 500 Internal Server Error.
The Google API uses custom status codes within the response body.
Feature | Google API | TravelTime API |
---|---|---|
Status Code | Custom code inside JSON body | Standard HTTP code, also included inside JSON body |
Root Elements | status | http_status error_code description documentation_link additional_info |
The response examples below show the error response for a poorly formatted JSON request, with http error code 400.
{
"destination_addresses": [],
"origin_addresses": [],
"rows": [],
"status": "INVALID_REQUEST"
}
{
"http_status": 400,
"error_code": 3,
"description": "Failed to parse json - syntax error",
"documentation_link": "https://docs.traveltime.com/reference/error-codes",
"additional_info": {
"syntax_errors": [
"Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries"
]
}
}
If you are looking to migrate from using the Google Distance Matrix API to TravelTime, you’ll need to first sign up for an API key.
Sign upTo help you get up and running, check out some of the links to more resources below.