Distance Between
Table of Contents
Overview
The zoho.map.distanceBetween task returns the flight distance between the specified source and destination addresses.
Note:
- Zoho Maps use open-source address data. Hence, accuracy might not be on par with commercial vendors.
- This task is available only in US, EU, IN domains due to the availability of Zoho Maps.
Syntax
<response> = zoho.map.distanceBetween(<source_address>, <destination_address, <unit>);
where:
Params | Data type | Description |
---|---|---|
<response> | NUMBER | The distance between the specified source and destination addresses. |
<source_address> | TEXT | The source address from which the flight distance needs to be calculated. |
<destination_address> | TEXT | The destination address until which the flight distance needs to be calculated. |
<unit> | TEXT | The unit in which the distance needs to be returned.
Note: This is an optional parameter in Zoho Creator. If the <unit> parameter is not specified, the distance is returned in miles by default. |
Example
The following script returns the flight distance (in miles) between the specified source and destination addresses:
response = zoho.map.distanceBetween("Chennai, Tamil Nadu, India", "Austin, Texas, US", "MILE");
where:
response
The NUMBER variable that holds distance (in miles) between the specified addresses. This example returns 9458.287130449206.
"Chennai, Tamil Nadu, India"
The TEXT that represents the source address.
"Austin, Texas, US"
The TEXT that represents the destination address.
"MILE"
The TEXT that represents the unit in which the distance needs to be returned.
Response Format
Failure Response
The failure response for an undetectable source and destination addresses will be returned in the following format:
{
"error": "unable to geocode",
"status": "failure"
}