## What is a Distance Matrix API?

A Distance Matrix API is a web service that calculates the distances and journey times between a set of origins and destinations.

Use cases for a distance matrix are incredibly broad, from fleet optimisation to gravity modelling to B2C search applications. The number of different providers in the market is also very extensive, from Google to Mapbox to TravelTime, all offering similar features and functionality.

There are a number of different providers offering similar products to meet these different application areas, often with slightly different features that can be hard to disentangle in order to work out how they stack up against one another.

There are a couple of key areas where differences between different providers are more obvious though:

- what size matrices can you generate, and how quickly?*Usage limits*- how much does it cost to generate matrices of different sizes?*Pricing*

## Usage limit considerations

For usage limits, restrictions normally come in two forms:

- How many locations can be included in a matrix?
- How many requests can be made to the API in a given time period (usually per minute)?

In other words, how big can a single matrix be and how quickly can you make multiple matrices?

## Pricing considerations

For pricing, Distance Matrix API providers typically offer:

- A free tier
- Variable pricing based on the number of ‘elements’ used

Very occasionally a provider will calculate their own unit to price on (e.g “Elements / 2”) but the general idea is exactly the same - the more data you need, the more you pay.

*What is an element?*

An element is a single result in a matrix (i.e the distance and/or travel time between one origin and one destination). So for example, a matrix with 1 origin and 1,000 destinations would be 1,000 elements (1 x 1,000), while a matrix with 10 origins and 20 destinations would be 200 elements (10 x 20).

## Usage based pricing vs. TravelTime’s unlimited usage pricing

TravelTime is the only provider in the market that does not price on elements (or a metric related to elements). Instead, we offer fixed monthly pricing based solely on the maximum concurrency required. We measure concurrency based on ‘Hits’.

Our base level Unlimited Plan gives a maximum concurrency of 60 Hits Per Minute, for a fixed price of £450 per month.

*What is a hit & how does it compare to an element?*

A hit is a single one-to-many or many-to-one matrix request. The number of elements that can be included in a single hit depends on which TravelTime API endpoint is being used:

- Time Filter- up to 2,000 elements in each hit
- Time Filter Fast- up to 100,000 elements in each hit
- Time Filter Fast Protobuf- up to 200,000 elements in each hit

*So how many elements can I use each month?*

Using the Time Filter Fast endpoint, the base level Unlimited Plan of 60 hits per minute gives a limit of 6 million elements per minute. Maxing this out over the course of a month, we could calculate over 200 billion elements per month, all for a fixed price of £450 per month.

## Comparing the different Distance Matrix providers

To compare the different providers, we’re going to consider two typical applications of a Distance Matrix API, but covering very different use cases and usage profiles:

- A consumer facing search application, that will involve lots of one-to-many matrices
- A route scheduling application that will involve just a few many-to-many matrices

**Scenario 1: Using a distance matrix API on a consumer facing application**

Search Scenario Price(per month) | Maximum One-To-Many Matrix Size | Maximum Requests(per minute) | |
---|---|---|---|

TravelTime | $585 -try our unlimited plan free! | 100,000 | 60 |

$799,900 | 100 | 600 | |

Mapbox | $240,400 | 25 | 60 |

TomTom | $4,000,000 | 200 | 10 |

Bing | Not publicly available | 625 | Unknown |

OpenRouteService | Not possible with maximum allowed usage | 50 | 40 |

Nextbillion.ai | $151,050 | 5,000 | 6,000 |

Graphhopper | Not possible with maximum allowed usage | 150 | 50,000 credits per day* |

** Credits = either #origins x #destinations / 2 or max(#origins, #destinations) x 10 is used. Depending on which is smaller.*

In the first scenario, we operate a web application that allows users to search for jobs near to where they live. Each time a visitor searches the site a one-to-many matrix is generated, calculating the distances and journey times between their home location and the locations of all available jobs on the site that match the search criteria (e.g the job title and salary).

In terms of specific values:

- The site gets 100,000 visitors per month, each conducting a single job search
- There are on average 2,000 live job postings that meet a typical search criteria

This means that each month we need to use a Distance Matrix API to generate 100,000 matrices, each of size 1 x 2,000.

The table above shows how much this would cost for the different Distance Matrix API providers, per month. For consistency, where multiple plans are available we have taken the highest available plan that is published publicly.

**Scenario 2: Using a distance matrix API for a routing application**

Big Data Scenario Price(per month) | Time Required(minutes) | |
---|---|---|

TravelTime | $585 | 22 |

$25,900 | 27 | |

Mapbox | $8,200 | 1,082 |

TomTom | $200 | 232 |

Bing | Not publicly available | Unknown (2,600 requests required) |

OpenRouteService | Not possible with maximum allowed usage | Not possible with maximum allowed usage |

Nextbillion.ai | $6,925 | 1* |

Graphhopper | $384 | Not possible with maximum allowed usage |

** Based on maximum usage allowed per minute. Actual time required may depend on API response times.*

In the first scenario, we operate a web application that allows users to search for jobs near to where they live. Each time a visitor searches the site a one-to-many matrix is generated, calculating the distances and journey times between their home location and the locations of all available jobs on the site that match the search criteria (e.g the job title and salary).

In our second scenario, our company has a fleet of 50 service engineers, who between them conduct on average 1,250 customer home visits each week. At the start of each week we build a schedule of visits for each engineer based on an efficient routing calculation. To do so, we need to know the driving times from each engineer to each customer home, and from each customer home to each other customer home.

The calculations we make at the start of each week are:

- A matrix of each engineer to each customer (50 x 1,250)
- A matrix of each customer to each customer (1,250 x 1,250)

The table above is a breakdown of how much this would cost for the different Distance Matrix API providers, per month. We’ve also taken the usage limits to calculate how long it would take to get the required amount of data.

## What do these results mean?

The comparisons of usage Limits and pricing can be looked at separately, but it often makes more sense to assess a provider by looking at both together.

For example, if we were looking for a provider to power a location-based search on a web application, then the very high limits provided by nextbillion.ai (6,000 requests per minute) look incredibly appealing. When we look at the cost of such high concurrency, however, it quickly becomes apparent that this is unlikely to be affordable, coming in at over $150,000 per month just to power 100,000 searches in our job site example.

Similarly, if we wanted to use a Distance Matrix API provider to power our route scheduling application example, looking solely at cost makes TomTom appear to be an attractive option at just $200 per month. However, when we take into account that for synchronous requests, there is a limit of 200 locations per request, and a maximum of 10 requests per minute, it turns out that to run the calculations we need would take over 12 hours each week.

## Choosing a Distance Matrix API provider to suit your needs

When choosing between the different Distance Matrix API providers, the features and functionality on offer are often broadly similar, but where the biggest differences come in are around Pricing and Usage Limits.

When making your decision, we’d always advise that you map out what sort of usage you are expecting to see, and then pick a provider that can both meet your requirements in terms of both usage and budget.

**Ready to try TravelTime?**

TravelTime is built for high volume users focused on performance and data accuracy.

- High usage limits
- Low cost