Distance Between

Note:

  • Each time the zoho.map.distanceBetween integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
  • Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.map.distanceBetween integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script. 

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:

ParamsData typeDescription
<response>NUMBERThe distance between the specified source and destination addresses.
<source_address>TEXTThe source address from which the flight distance needs to be calculated.
<destination_address>TEXTThe destination address until which the flight distance needs to be calculated.
<unit>TEXT

The unit in which the distance needs to be returned.

  • MILE
  • KILOMETRE
  • NAUTICAL

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"
     }

Related Links