“Movement is life, and life is movement,” – said one ancient Greek philosopher. There is no doubt that this statement fully reflects the current rhythm of modern human`s life. And this means that a large number of tools, systems and technologies related to geological information, such as the DistanceMatrix tool, have firmly occupied their niche in the global information structure.
Not so long ago, Google maps were considered as the main assistants in the field of logistics and transport services. However, despite their obvious importance and usefulness, they can no longer satisfy fully the ever-increasing demands of users.
For example, very often customer`s requests are not just about to obtain information about the location of one or another object on the map and the distance to it, but also relate to element-by-element movement within this distance, relate to local routes within certain settlements, relate to logistical and regional features that may be present on selected route.
Every person who plans his business or personal trips to different parts of our planet is interested in their optimal implementation, both in terms of saving time and in terms of reducing the cost of these trips. And in this case the Distance Matrix becomes a good helper in this. This is a handy and useful tool. The Distance Matrix allows you to get data on general and local distances between certain settlements, on the time which is required to cover these distances, as well as on specific circumstances that may affect movement for example traffic jams, the type of vehicle used, the number of traffic lanes, minimum time and minimum distance, etc.
And now in detail
Distance Matrix can be available in several formats, one of which is the API Distance Matrix format.
Why is the API Distance Matrix format the most convenient? The fact is that the API interface allows you to synchronize data between different sources. It`s very comfortable for the users because greatly facilitates the work of such of them which decide to have in advance a full information about planned moving.
The API operation algorithm is as follows: the application-client makes the necessary request to the application-server for obtaining this or that information and the API interface provides interaction between both of these applications by using its functions and methods. How it can be related with comfortable moving which is planning by users? It`s very simple. Since the functional feature of the API is the transfer of data according to a specific application-client request to the application-server then in relation to the Distance Matrix it may look as the next: some user wants to receive information, for example, about the distance between certain locations or settlements and about the time to overcome them and requests this one using the API interface of Distance Matrix.
According to above to obtain the necessary information the application-client request to the appropriate Distance Matrix application-server is required. Further actions of the API interface are based on calculations of various variations from the initial to the final location. The API response data includes priority travel duration calculations and travel time predictions based on existing traffic information on the requested route.
The final distance matrix table is generated in JSON format. At the same time, the API Distance Matrix is able to cover all points of the world, as well as take into account various forms of movement – vehicles, bicycles, walking, etc.
The multiplicity of options in the API response will certainly take into account the most optimal and economical route options, regardless of the number of initial elements in the matrix.
What it looks like in practice
For example, you need to obtain accurate data on the distance in meters and the time in seconds to overcome this distance between three initial points and three destination locations in various combinations. After the corresponding request of the application-client to the application-server by using API, you will receive a response in the form of a distance matrix. It will indicate the distances and all the time of movement, taking into account various combinations between the requested three initial points and three destination locations. However, in this case, the motion geometry is not reflected in the response.
The user who makes a request by the help of the API needs to be reminded that there are data which are required to be included into the request. This is:
1 – sources (initial location – one or more points, which can be described either by an address or a coordinate system, taking into account latitude and longitude)
2 – destination (final location – one or more points, which can be described either by an address or a coordinate system, taking into account latitude and longitude)
3 – key (special API access key).
Except necessary data there are some information which may be or may not be include to the request. It means that the absence of some parameters to the request does not prevent the API from responding. Beside this there are some parameters which are defined by the default interface. These parameters as well as the other optional ones are reflected in the relevant sections of the Distance Matrix Developer’s Guide.
After processing the application-client’s request, the API generates a so-called distance matrix response or in other words – the respond.
Similar to the request structure, the response structure also should to contain base positions. Firstly – it is mandatory to be indicated the status of the information that was generated as a result of processing the request. Detailed structuring of status indicators is showed in the so-called “Status Codes”, which cover both the upper level of information and the cascade of elemental levels.
The undoubted advantage of the API is that the respond is always returned to the client as an array of JSON strings. The respond is returned even if it does not contain the results of processing the request. This situation may occur if the request was incorrect or the initial points and/or destination locations specified in the request were not found. In this case, the respond will contain empty arrays and the corresponding status codes (see information above).
That’s why it’s better
In conclusion, we can say that there are certainly API of various websites on the market, such as Google distance API, Traveltime, Mapbox, Openrouteservice, OSRM, Graphhopper and others.
With all their undoubted merits, these API have a number of limitations related to various regional peculiarities, responses containing information that is not collected in real time, and also not including a sufficient number of necessary elements.
A counterweight to such limitations, the API Distance Matrix includes all the features necessary to satisfy any user request.