Travel Time & Distance in Distance Matrix API
Do you know that in the field of business there is a constant registration and processing of a large number of orders? And almost all of them relate to their transportation and delivery to customers in various parts of the globe? So it is not an easy task for specialists who are engaged in the processes of such deliveries planning. They have to calculate routes in such a way as to optimize the planned routes as much as possible and, thus, to reduce the delivery time and the cost of their implementation.
It is possible to help significantly in the implementation of this task. We need to use the method of accumulating, systematizing and selecting the most optimal information about the relocation time between different locations indicated in the routes. In other words, it is necessary to involve as an assistant the travel time api interface, as the most reliable service that can perform easily all the important and voluminous actions regarded to the plans of the routes.
So, let’s see if the statement is true that the distance matrix api (DMA) service helps significantly in planning routes, when the first place is not only the calculation of distances between different locations of the route, but the determination of the relocation time between them. At the same time, the fact that there can be thousands of onset and spot locations around the world does not in the least prevent DMA to perform calculations very quickly and to provide information in a format which is understandable to users. Target objects for calculating relocation time can be both different types of transport – cars, bicycles, trucks and public transport, as well as pedestrians.
The undoubted advantages of DMA are its ability to include in the calculation of the relocation time such factors as the relocation nuances itself, the current situation on the routes and traffic-related forecasts.
How to start
What needs to be done by the utilizer who decided to involve DMA for relocation time calculations? First of all, the he must form a request in http-format.
Let’s imagine that a food delivery service is faced with the need to plan optimally a route, which have three onset locations: 1, 2, 3 and four finite locations: 1, 2, 3, 4. At the same time, his transport device is a bicycle, and the main task is to deliver food in the shortest possible timeframes. It`s obviously, that the shortest distance between locations not always means that the time it takes to cover this distance will also be minimal. The reason is that to overcome some route we have to consider different both current and predicted road nuances – single-lane or multi-lane traffic, traffic jams, normal and reverse mode, the presence or absence of turns, etc.
Prior to the advent of MDA, the food delivery service would have to take into account all the above features, to search and analyze a large amount of information from various sources and to make its own subjective assumptions. Now, just like any utilizer, it is enough for it to make an HTTP query for DMA. This query must include both mandatory and optional parameters.
Mandatory query parameter No. 1 – determination of locations. For example, regarding to our illustration, we must note that the food delivery service has to specify the onset and finite locations. These will be onset points 1, 2, 3 and finite points 1, 2, 3, 4. To separate several locations from each other, you need to put a vertical bar between them in the query. It is important that the utilizer can indicate these locations in any way that is acceptable to him – a regular address or geographic coordinates. When a utilizer specifies a regular address, the service independently encodes it into geo-coordinates; when a utilizer specifies geo-coordinates, the service uses them on an “as is” basis.
Mandatory query parameter No. 2 is a special identifier or api key (KA). Each utilizer must have their own special KA. It is assigned to him when he registers himself on the service and it is needed not only to recognize each utilizer by the service and protect his information, but also to save the search history and the ability to regulate the utilizer’s tariff relationship with the service.
Unlike mandatory query parameters, optional parameters may not be included in the query. There are several such parameters and detailed information about them you can glean from the DMA documentation.
So, the http-query is sent to the service, and after processing for a short period of time, the DMA generates a response. Just like a query, a response contains mandatory parameters. First of all, it is the status of the result. If the utilizer’s query is executed correctly, and take into account all the necessary parameters, the KA is available and valid, the service usage limit is not exceeded, the utilizer’s account meets all the necessary requirements, then the response status will be marked by “OK” and contain the results on query. Otherwise, the response will contain an appropriate section with information about the reasons for the lack of a result. At the same time, it is very important to remember that the response of the service to the utilizer’s query will always be, regardless of whether the query was correct or incorrect.