DISTANCE MATRIX OVERVIEW
Distance Matrix, also known as the distance matrix, is a type of API that allows users to calculate the distance and travel time between multiple locations.
This API provides information on the travel distance between points, estimated travel time, and even details about different routes. The Distance Matrix API can return time and distance for a matrix of multiple points along a route.
Map Fusion Distance Matrix is commonly used in route planning, cargo transportation, fleet management, and applications related to travel and location tracking. It provides specific information to optimize routes and manage travel resources.
Integrating this API offers many benefits for applications and services, especially in managing routes for goods delivery, passenger pick-up and drop-off, logistics, travel planning, and many other applications.
Reasons to Use the Distance Matrix API
Route Optimization: The Distance Matrix API helps calculate the distance and travel time between different locations, which is essential for optimizing routes. This is particularly important in reducing travel time and transportation costs for services that require the movement of goods or people.
Trip Planning: It provides information about the distance and travel time between destinations, making it easier for users to plan their trips more efficiently.
Logistics Management Optimization: The API offers detailed information on distances and travel times, helping businesses optimize their logistics planning. Logistics companies can use this API to analyze and optimize delivery routes, reducing costs and increasing operational efficiency.
How to Make a Distance Matrix Request
First, you need to sign up for an account and create your Map Fusion API key following the instructions provided here.
Start by entering the URL in your web browser and replace YOUR_API_KEY with the API key you created. The response will provide the distance and travel time between the specified origin and destination points.
URL: /distancematrix
Method: GET
Example request:
curl "https://api.mapfusion.io/v1/distancematrix?origins=16.786443,96.159425&destinations=16.797456,96.158462%7C16.792558,96.164295%7C16.783920,96.161034&vehicle=car&api_key={YOUR_API_KEY}"
Parameter | Description | Example |
origins | A list (string) of origin points (required). | 16.786443,96.159425 |
destinations | DA list (string) of destination points (required). | 16.797456,96.158462
16.792558,96.164295 16.783920,96.16103 |
vehicle | Type of vehicle, including: car, bike, taxi, truck, hd (for ride-hailing vehicles). | car |
Example Response:
application/json
{ "rows": [ { "elements": [ { "distance": { "text": "85.60 km", "value": 85600 }, "duration": { "text": "2 နာရီ 25 မိနစ်", "value": 8676 }, "status": "OK" } ] } ] }
Parameter | Description | Example |
rows | An array of objects containing routes, where each row corresponds to a pair of origin and destination. The route includes status, time, and distance. |
{ “elements”: [ { “distance”: {}, “duration”: {}, “status”: “OK” } ] } |
elements | A sub-element of rows corresponding to each origin-destination pair. These tables contain information about status, time (in seconds), and distance (in meters) for each segment of the route. |
{ "distance": { "text": "85.60 km", "value": 85600 }, "duration": { "text": "2 နာရီ 25 မိနစ်", "value": 8676 }, |
status | The status code “OK” means success. | ok |
duration | The time taken to travel each segment (time as text, with the value being the time spent on the segment, in minutes). | 2 hours 25 minutes |
distance | The distance covered for each segment (distance as text, with the value being the distance in kilometers). | 85.5 km |
Conclusion
Map Fusion Distance Matrix API optimizes routes, reduces operational costs, and enhances travel efficiency. Whether in logistics, delivery, or tourism, this API provides accurate data to support effective route management. Integrate it today to streamline operations and improve user experience!