🌐
Coordinates Distance API
Calculate the distance between any two coordinates on the map, and express the calculation in different measurement units using our Coordinates Distance API.
You need to provide your API key for every API request you make. Please refer to the Getting Started section for more details.
You can check our Errors section to understand how we handle errors and the responses you will receive in cases when errors occur.
Endpoint used for calculating the distance between two coordinates.
Key | Explanation | Type | Required |
---|---|---|---|
start | Comma-separated start coordinates. | string | true |
end | Comma-separated end coordinates. | string | true |
unit | Unit of length used. Default to kilometer . Accepted values are: meter , kilometer , mile . | string | false |
The following example shows how to calculate the distance between any two coordinates:
GET distance?start=48.857,2.351&end=40.712,74.006
RESPONSE:
{
"start": {
"latitude": 48.857,
"longitude": 2.351
},
"end": {
"latitude": 40.712,
"longitude": 74.006
},
"unit": "kilometer",
"result": 5521.10621
}
If you would like to use a different length unit, you could specify the
unit
parameter. The following example calculates the distance between two coordinates in miles:GET distance?start=48.857,2.351&end=40.712,74.006&unit=mile
RESPONSE:
{
"start": {
"latitude": 48.857,
"longitude": 2.351
},
"end": {
"latitude": 40.712,
"longitude": 74.006
},
"unit": "mile",
"result": 3430.65528
}
Every successful response will have the structure explained in the table below:
Key | Explanation | Type |
---|---|---|
start.latitude | Latitude of the start point of calcution. | number |
start.longitude | Longitude of the start point of calcution. | number |
end.latitude | Latitude of the end point of calcution. | number |
end.longitude | Longitude of the end point of calcution. | number |
unit | Indicates which lenth unit was used for the calculation. | string |
result | Represents the distance between two specified coordinates, expressed in the specified length unit. | number |
Last modified 1yr ago