Learning

How to Use the Distance Matrix API

What can you do with the Distance Matrix API?

Life is so arranged that a person often uses things, the principle of which he does not understand. This can be fully attributed to the API. This interface has a set of specific functions that allow different programs to interact with each other. Many companies develop various APIs, both for internal use and for clients.

There are many different APIs, but today we will introduce you briefly to the Distance Matrix API, one of the most popular software products offered to users by distancematrix.ai.

Why is the Distance Matrix (DM) API program so in demand by users? Because it is impossible to imagine modern life without the constant movement of people, goods, and all kinds of cargo between different points of our planet. And this means that, regardless of the purpose of the movement, all interested persons or companies must clearly plan both the distances between the starting and ending points of the movement and the time that may be required to pass this distance. And just all these questions are illuminated by DM API.

When users began to act with this interface they can get knowledge about the perfect variant of the planned route almost instantly. To say clearly they can find the brief spacing betwixt the given two (or more) points on the map, as well as the time required to move between these points, which will be provided to the user by the Distance Matrix API program.

Why use Distance Matrix API?

It is no secret that our personal and operational tasks largely depend on both our mobility and the logistical capabilities of various services. Personal trips, trucking, taxi services, food delivery, courier services, etc. very often need to draw up certain unique routes and to calculate the optimal time. In this case, specific factors that are inherent in each specific type of movement should be taken into account.

So, our simplest using DM API – is to get data on how to best plan the route we need. Why is directly this program the most preferable for us?

First of all, this interface is very convenient to use. An easy combination of actions with DM API does not require a large array of user knowledge, elementary knowledge and skills in working with software products will be sufficient. And we remind you that there is DM API documentation, which is a kind of guideline for using this interface.

The next undoubted excellence of DM API is next – it takes into account the real situation when it generates information about the requested route – various driving modes, traffic jams along the roads, etc.

In addition, waiting for a response after sending a request takes a minimal amount of time when we operate with the interface. That means that up to 5000 items per second can be generated, and the accuracy of the response is comparable to such recognized services as Google, TomTom, and Bing. At the same time, the information coverage area is practically the entire world space.

And, of course, one of the main factors in precedency of the DM API is the rather low cost of handling info about the length of the route and the period it takes to complete it.

How to use Distance Matrix API?

And now briefly about how it works. The algorithm of actions is very simple: the first is the formation and sending of an HTTP request, and the second is the receipt of a response in JSON format.

It should be noted that for the convenience and facilitation of the work of users, the practical identity of the kind of requests of DM API program with the kind of requests of Google`s DM API program has been achieved.

Obviously, in order to obtain the necessary information about the planned route, it is necessary to specify the geographical coordinates in the request, both the points of departure and the points of arrival (there may be several indicated points).

You can`t provide geographic coordinates? This is not a problem, since the request can include just a usual address (country, city, street, house, etc.). The task of the service is to transform the address into geographic coordinates.

Another required component of the request is the so-called API key. This is a kind of encrypted user ID that can be created in the corresponding service settings.

In addition to the listed mandatory components, additional parameters can be included in the request, a list of which you can find in the corresponding chapter of “Guidelines for Developers”.

Distance Matrix API replies are synchronized with requests and include several elements, the list of which can also be found in the corresponding section of “Guidelines for Developers”.

Concluding this concise tour of DM API, we can note once again the advantages of this interface – easy use, excellent performance, low cost, and a result that fully satisfies applicable requirements.