v8 Control Hero Item

Distance Matrix API

Calculate travel times and distances between a set of origins and destinations


Distance Matrix API

 

Traditionally used for Traveling Salesmen or Vehicle Routing scenarios, the Bing Maps Distance Matrix API assists in calculating travel time and distances in many-to-many scenarios with an optional travel-time histogram. Used to optimize routing, the Distance Matrix API service determines the best route possible, by reordering stops based on the trip’s parameters, including time or distance, mode of transportation, start and end time, predicted traffic, and more.


Bing Maps Distance Matrix API Features

Optimize route
Optimize route

Set parameters and visualize trip on a map

Improved Performance
Improved Performance

Data analysis and clustering

Predictive Traffic
Predictive Traffic

Determine best time and day of the week

Modes
Modes

Driving, walking and public transportation

Travel-time
Travel-time

Histogram in 15 minute intervals

 

Power Route Optimization Calculations

Types of Route Optimizations:
  • Traveling Salesmen Problem (TSP) – single user
  • Vehicle Routing Problem (VRP) – fleet of vehicles
Route Optimization Considerations:
  • Time Windows
  • Pickup and Delivery locations
  • Vehicle Capacity
  • Multiple depots
  • Split deliveries
  • Backhauls

LEARN MORE

Image of a map showing navigation link between two areas

Bing Maps Fleet and Logistics API Services

From personalized experiences to advanced scenarios in the logistics sector, Bing Maps has you covered. Check out the geospatial API services and solutions for enhanced fleet management, routing, vehicle tracking and more.

  • Isochrone API – Provides time-specific isochrones, given the area that can be reach in the time and space criteria.
  • Snap to Road API – Snap the path to the most logical path, using the vehicles GPS trace, as well as returns road attributes, such as speed limit and elevation.
  • Truck Routing API – Determine travel routes that take into consideration a truck or commercial vehicle’s attributes.

Get Started

Distance Matrix API uses billable transactions. If you have a Bing Maps key, review the Distance Matrix API documentation to learn more and start developing your distance matrix solution. If you don’t have a Bing Maps key, create a Bing Maps account and create a key to authenticate your application. Then follow the documentation to start developing your distance matrix solution.

For Licensing questions, contact a Bing Maps Sales Specialist.


CONTACT US

FAQ

A: To try this service, create a basic account, which will provide up to 125K transactions per calendar year at no charge. Above this usage limit, you will need to purchase a license. To purchase Transactions or Per Asset license, contact a Sales Specialist. To start developing with this API, use the Distance Matrix API documentation.

  • Distance Matrix API is available for Public and Internal transaction website licensing. It is not available for Known or Light Known users.
  • For Mobile Asset Management, the Distance Matrix API is available by purchasing an add-on license (Note- you must have the underlying Asset Management per asset license first).

A: Enterprise Customers will be able to license via the following options:

  1. Public or Internal Website Transactions (when using in an application that is not related to asset tracking) -
    If you are not licensed for Public or Internal Transactions, you can purchase these from your sales partner.
    • You will need to create a separate account ID on the Bing Maps Dev Center that will be specific to your internal transaction usage.
    • Distance Matrix API is available for Public and Internal transaction website licensing. It is not available for Known or Light Known users.
    Note - This API will increase the consumption of billable transactions, which may result in the need to purchase additional transactions.
  2. Per Asset (applicable when being used as part of asset tracking solution) - To use the Distance Matrix API, you will need an underlying Asset Management per asset license (with or without routing) and will the need to purchase an additional per asset license for the use of this new service. For licensing and pricing questions, please contact a Sales Specialist.

A: When calculating a simple distance matrix each origin-destination pair will generate a single cell in the matrix.

    Total # of cells = # of origins * # of destinations

For example, a matrix that has 2 origins, and 5 destinations, will generate 10 cells where 2 * 5 = 10.

When a matrix includes a histogram, each origin-destination pair will have a cell in the matrix for each time interval. The number of time intervals that a request will have depends on the resolution, start and end times.

    Total # of cells = # origins * # destinations * (endTime in hours-startTime in hours) / resolution*0.25

For example, a matrix that has 2 origins, 5 destinations, and retrieves time intervals in 15-minute increments (resolution = 1) over 24 hours, will generate 960 cells where 2 * 5 * 24/0.25 = 2 * 5 * 24 * 4 = 960.


Note:
Cells will not be generated for origin-destination pairs that have the same index and coordinate. These will not be included in the transaction counts. If these exist in your query, you can subtract these from the calculated number of cells above to get a more accurate number for estimating transaction counts.

A: How to calculate total number of billable transactions a request will generate
A billable transaction is generated for every 4 cells in a matrix, rounded up to the nearest whole integer. For a simple matrix, billable transactions will be calculated using the following formula:

    Total # of billable transactions = Ceiling (# origins * # destinations * ¼)

For example, a matrix that has 4 origins, and 5 destinations, will generate 5 billable transactions where Ceiling(4 * 5 * ¼) = 5.

When calculating a matrix which includes a histogram, only the first 30 time intervals in each origin-destination pair are counted towards billable transactions, any additional time intervals are provided for free.

    Total # of billable transactions =
    Ceiling (¼ * # origins * # destinations * Min (30, endTime in hours - startTime in hours / resolution * 0.25))


For example, a matrix that has 4 origins, 5 destinations, and retrieves time intervals in 15 minute increments (resolution = 1) over 24 hours, will generate 150 cells where Ceiling(¼ * 4 * 5 * Min(30, 24/0.25)) = Ceiling(¼ * 4 * 5 * Min(30, 96)) = Ceiling(¼ * 4 * 5 * 30) = 150. Note that 24/0.25 = 24 * 4 = 96, but since only the first increments per origin-destination pair is counted towards billable transaction, 66 time intervals are excluded from the transaction calculation per origin-destination pair, thus saving you a total of 330 billable transactions in this scenario.

A: A standard distance matrix can have up to 625 origin-destination pairs. A single cell in a matrix is created for each origin-destination pair. Thus, multiplying the number of origins by the number of destinations will provide you with the number of origin-destination pairs. If this number is equal to or less than 625, the origins and destinations can be passed into a single request. For example, you can have 1 origin and 625 destinations, or 25 origins and 25 destinations. See the Distance Matrix API documentation for more information.

For a distance matrix that provides a histogram, the API allows up to a total of 100 origin-destination pairs. For example, 1 origin and 100 destinations, or 10 origins and 10 destinations.

A: To try the Distance Matrix API, you will need to create a Basic key. When you are ready to deploy into production, you will need to upgrade to an Enterprise key.

A: The Distance Matrix API is available for Basic and Enterprise accounts (normal TOU limits will apply for Basic accounts), and is available for Public and Internal Website transactions or as an additional per asset license. It is not available for Known or Light Known users.

If you would like to try the API, you can create a Basic key. To deploy into production, you will need to upgrade to an Enterprise key.

A: Take a look at this project on GitHub, as it makes it easy to use the Distance Matrix API in .NET and also includes examples on how to use the Distance Matrix API.

A: To develop and deploy this service, refer to the Distance Matrix API documentation. If you have licensing questions, please contact a Sales Specialist. For Enterprise Customer Support, click here. Or check out the Bing Maps Developer Network forum.

Bing Maps Resources

  • Click here for Bing Maps case studies.