With the Distance Calculation API, users can easily obtain the distance between two geographic locations. The API uses sophisticated algorithms and mapping technologies to calculate the shortest distance along the Earth's surface, taking into account various factors such as road networks, terrain and geographical obstacles.
The Distance Calculation API offers various output formats to suit different preferences and use cases. Users can choose to receive measurements between kilometers and miles, depending on their needs.
In addition, the Distance Calculation API is designed to be scalable and efficient, capable of handling a large volume of requests with minimal latency. This scalability ensures that the API can adapt to the needs of users of all sizes, from small startups to large enterprises.
In conclusion, the Distance Calculation API offers a complete solution for calculating distances between two locations. Thanks to its ease of use, flexibility, reliability and scalability, the API is an essential tool for users. Whether you are planning a trip, optimizing logistics or developing location-based services, the Distance Calculator API provides you with the precise distance measurements you need to succeed.
It will receive a parameter and provide you with a JSON.
Besides the number of API calls, there is no other limitation.
To use this endpoint you must indicate 2 locations in the parameter. There is also an optional parameter where you can indicate the unit of measurement (kilometers or miles).
Get distances - Endpoint Features
| Object | Description |
|---|---|
location1 |
[Required] Indicates the first location |
location2 |
[Required] Indicates the second location |
unit |
Optional Indicates the unit of measurement |
{
"distance": 1673.4448632836118,
"unit": "kilometers",
"location1": {
"place_id": 15496907,
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
"osm_type": "relation",
"osm_id": 1224652,
"lat": "-34.6037181",
"lon": "-58.38153",
"class": "boundary",
"type": "administrative",
"place_rank": 16,
"importance": 0.7279817834797908,
"addresstype": "city",
"name": "Buenos Aires",
"display_name": "Buenos Aires, Comuna 1, Autonomous City of Buenos Aires, Argentina",
"address": {
"city": "Buenos Aires",
"ISO3166-2-lvl8": "AR-C",
"state_district": "Comuna 1",
"state": "Autonomous City of Buenos Aires",
"ISO3166-2-lvl4": "AR-C",
"country": "Argentina",
"country_code": "ar"
},
"boundingbox": [
"-34.7056370",
"-34.5265535",
"-58.5314494",
"-58.3351423"
]
},
"location2": {
"place_id": 382868521,
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
"osm_type": "relation",
"osm_id": 298285,
"lat": "-23.5506507",
"lon": "-46.6333824",
"class": "boundary",
"type": "administrative",
"place_rank": 16,
"importance": 0.6861749119420276,
"addresstype": "municipality",
"name": "São Paulo",
"display_name": "São Paulo, Região Imediata de São Paulo, Região Metropolitana de São Paulo, Região Geográfica Intermediária de São Paulo, São Paulo, Southeast Region, Brazil",
"address": {
"municipality": "São Paulo",
"county": "Região Metropolitana de São Paulo",
"state_district": "Região Geográfica Intermediária de São Paulo",
"state": "São Paulo",
"ISO3166-2-lvl4": "BR-SP",
"region": "Southeast Region",
"country": "Brazil",
"country_code": "br"
},
"boundingbox": [
"-24.0079003",
"-23.3577551",
"-46.8262692",
"-46.3650898"
]
}
}
curl --location --request GET 'https://zylalabs.com/api/3665/distance+calculation+api/4136/get+distances?location1=Buenos Aires&location2=Sao Paulo&unit=kilometers' --header 'Authorization: Bearer YOUR_API_KEY'
| Header | Description |
|---|---|
Authorization
|
[Required] Should be Bearer access_key. See "Your API Access Key" above when you are subscribed. |
No long-term commitment. Upgrade, downgrade, or cancel anytime. Free Trial includes up to 50 requests.
Users must indicate 2 locations to measure the distance.
The Distance Calculation API allows users to calculate the distance between two geographic locations.
There are different plans to suit all tastes, including a free trial for a small number of requests, but your rate is limited to avoid abuse of the service.
Zyla provides a wide range of integration methods for almost all programming languages. You can use these codes to integrate with your project as you need.
The API returns a JSON object containing the calculated distance between two locations, the unit of measurement (kilometers or miles), and detailed information about each location, including coordinates and place identifiers.
Key fields in the response include "distance" (numeric value), "unit" (measurement unit), and "location1" and "location2" objects, which provide details like latitude, longitude, and place names.
The response data is structured as a JSON object. It includes a top-level distance measurement, the unit, and nested objects for each location, detailing their geographic and administrative attributes.
The endpoint accepts two mandatory parameters for the locations and an optional parameter to specify the unit of measurement (kilometers or miles) for the distance calculation.
Users can customize requests by specifying the two locations in the required format and optionally choosing their preferred unit of measurement to receive the distance in either kilometers or miles.
The Distance Calculation API utilizes data from OpenStreetMap contributors, ensuring a comprehensive and up-to-date mapping of geographic locations and road networks.
Data accuracy is maintained through continuous updates from OpenStreetMap and sophisticated algorithms that account for road networks and geographical features when calculating distances.
Typical use cases include route planning for deliveries, logistics optimization between warehouses, travel distance estimation, fitness tracking, and real estate analysis for proximity to amenities.
Please have a look at our Refund Policy: https://zylalabs.com/terms#refund
To obtain your API key, you first need to sign in to your account and subscribe to the API you want to use. Once subscribed, go to your Profile, open the Subscription section, and select the specific API. Your API key will be available there and can be used to authenticate your requests.
You can’t switch APIs during the free trial. If you subscribe to a different API, your trial will end and the new subscription will start as a paid plan.
If you don’t cancel before the 7th day, your free trial will end automatically and your subscription will switch to a paid plan under the same plan you originally subscribed to, meaning you will be charged and gain access to the API calls included in that plan.
The free trial ends when you reach 50 API requests or after 7 days, whichever comes first.
No, the free trial is available only once, so we recommend using it on the API that interests you the most. Most of our APIs offer a free trial, but some may not include this option.
Yes, we offer a 7-day free trial that allows you to make up to 50 API calls at no cost, so you can test our APIs without any commitment.
Zyla API Hub is like a big store for APIs, where you can find thousands of them all in one place. We also offer dedicated support and real-time monitoring of all APIs. Once you sign up, you can pick and choose which APIs you want to use. Just remember, each API needs its own subscription. But if you subscribe to multiple ones, you'll use the same key for all of them, making things easier for you.
Service Level:
100%
Response Time:
614ms
Service Level:
100%
Response Time:
345ms
Service Level:
100%
Response Time:
146ms
Service Level:
100%
Response Time:
445ms
Service Level:
100%
Response Time:
342ms
Service Level:
100%
Response Time:
92ms
Service Level:
100%
Response Time:
216ms
Service Level:
100%
Response Time:
159ms
Service Level:
100%
Response Time:
574ms
Service Level:
100%
Response Time:
110ms
Service Level:
100%
Response Time:
762ms
Service Level:
100%
Response Time:
814ms
Service Level:
100%
Response Time:
1,579ms
Service Level:
100%
Response Time:
158ms
Service Level:
100%
Response Time:
1,245ms
Service Level:
100%
Response Time:
236ms
Service Level:
100%
Response Time:
267ms
Service Level:
100%
Response Time:
2,153ms
Service Level:
100%
Response Time:
1,433ms
Service Level:
100%
Response Time:
219ms