DISTANCE macro
The DISTANCE
macro
is available in HCL®
Campaign and HCL
Interact.
Syntax
DISTANCE(lat1, long1, lat2,
long2[, UNIT_OF_MEASURE][, PRECISION])
Parameters
lat1
The latitude of the first point, as a decimal value.
long1
The longitude of the first point, as a decimal value.
lat2
The latitude of the second point, as a decimal value.
long2
The longitude of the second point, as a decimal value.
UNIT_OF_MEASURE
An optional parameter indicating the unit of measure for the returned distance. Values are MILES or KILOMETERS. If you omit this parameter, MILES is the default.
PRECISION
An optional parameter indicating the level of precision following the decimal point for the returned distance. If you specify a precision value, the returned distance is truncated to the number of decimal places you specify. The maximum value is 5. If you omit this value, the number of decimal places is not truncated.
Description
DISTANCE
calculates
the distance between two points. Latitude and longitude are expected
to be in decimal units. Always use a comma and a space to separate
numeric values. This is necessary to accommodate languages that use
a comma as a decimal separator, as shown in the second example below.
Examples
DISTANCE (18.529747,
73.839798, 18.533511, 73.8777995, MILES, 2)
returns the
value 2.50 Miles.
DISTANCE (18,529747, 73,839798,
18,533511, 73,8777995, KILOMETERS, 1)
returns the value
4,0 kilometers.