Skip to contents

Returns the road distance in km between two addresses. To reduce API calls, addresses are case-insensitive and whitespace-trimmed, empty addresses after processing return NA early, processed addresses are internally sorted, and results are memoized.

Usage

OR.Google.distance(a, b, key)

Arguments

a

String address A.

b

String address B.

key

String Google API key.

Value

Numeric distance in kilometres or NA if no route is found.

Details

If no route is found, input addresses are compared via Google Geocoding API; identical resolved addresses return 0, otherwise return NA.

See also

Other GoogleMapsPlatform: OR.Google.TSP(), OR.Google.address()