DistanceToBoundingGeometry() Function

 

The DistanceToBoundingGeometry() function returns the distance in miles between a location and the bounding geometry of a group of locations.

 

Important! This function is available only if your Platform administrator has enabled historical functions.

Syntax:

Number DistanceToBoundingGeometry(Array locations, Location location)

where:

locations - a list of previous locations from which the bounding geometry is created.

location - the current location to which the distance from the bounding location is measured.

 

If the current location is within the bounding geometry of the previous locations, this function returns 0.

The function takes an array of mobileLocation objects returned by the GetMobileLocationN function, as shown in the examples below.

Example of use:

The following example returns the distance of the current asset from the bounding geometry of its last ten locations:
 

DistanceToBoundingGeometry(GetMobileLocationN(10), location)


The following example returns the distance of the current asset from the bounding geometry of its last three locations and determines if the asset is outside the bounding geometry of the previous locations (that is, does the function return a value greater than zero). Either way, it writes the appropriate message to the Audit Log:

If Expression1 = "DistanceToBoundingGeometry(GetMobileLocationN(3), location) > 0" ;

Then Expression1 = "Audit(\"data-management\", \"Asset is outside Bounding Geometry\")";

Else Expression1 = "Audit(\"data-management\", \"Asset is within Bounding Geometry\")";