Get distance from asset to geofence function (DistanceToGeofence() function)

The DistanceToGeofence() function determines the distance between an asset and the edge of a specified circular geofence.

Format:

Number DistanceToGeofence(String center, Number radius, String location)

where:

center - latitude, longitude of the center of the geofence ; e.g., "42.3948532,-71.2938472"

radius - radius (miles) from the center - this defines the edge of the geofence

location - location of the asset. For a MobileLocation trigger, you can specify an unqualified "location". For all other triggers, you need to qualify this as "Location.location".

Example:

The following expression evaluates to true if the asset location is greater than three miles from the boundary of the geofence.

If: DistanceToGeofence("42.3948532,-71.2938472", 2.5, Location.location) >3