Geofence Node

The Geofence Node allows a workflow to branch based upon the distance between two coordinates.

Geofence Node

Configuration

The Geofence Node has 4 distinct configuration sections - the coordinates to check (the "input" coordinates), the center point coordinates, the center point radius, and an optional payload path for the calculated distance.

When the Geofence Node runs, it calculates the distance between the input and center point coordinates, and if that distance is less than or equal to the defined center point radius, the true route on the right out of the node is taken. If that distance is greater than the center point radius, the false route on the left out of the node is taken. If the distance between the two points cannot be calculated for some reason, the false route on the left out of the node is taken.

Geofence Node Example

In the above example, there are actually two different geofences. The first checks against a center point position that represents "Home". If that is true (the route to the right), it records that payload as being "At Home". If that is false (the route to the left), it moves on to the second geofence, which checks against a center point position that represents "Work". If that is true (the route to the right), it records that payload as being "At Work", but if that is false (the route to the left), it records that payload as being "Other".

Input Coordinate Configuration

Geofence Node Input Config

The input coordinates can be take any of the forms we support for GPS device state. No matter which form is used, the field will also accept a string template for the value. In the above example, the input coordinates are defined as the data.location field of the payload, which contains an NMEA string.

Center Point Coordinate Configuration

Geofence Node Center Config

The center point coordinates can be defined the same was as the input coordinates, in any one of the forms we support for GPS device state. While in the common case, the center point coordinate values will be static, these fields also support string templates in case a dynamic center point is needed. Because the common case is a static center point, a map visualization is displayed to help show the real world location of the geofence. In the above example, the center point coordinates are defined statically using decimal degrees.

Radius Configuration

Geofence Node Radius Config

The radius of the center point is defined in meters, and must be greater than 0. If the radius is defined as 0 meters, only an exact match between the center point and input point will count as being "within" the geofence. In the common case, the radius will be defined as a static value, but the field does support string templates in case the radius needs to be dynamically defined based upon the current payload. If the radius (and center point) are defined statically, the map visualization will show the extent of the real world location of the geofence. In the above example, the radius is defined as 50 meters, and the map shows what that actually covers in the physical world.

Adding Distance or Branch to the Payload

Geofence Node Distance Value

The Geofence Node has the ability to optionally add the calculated distance between the input and center point to the payload at a defined payload path. If a path is defined, the distance (in meters) will be placed at that path no matter which branch out of the Geofence Node is taken. If there is a problem calculating the distance (bad coordinates or radius), no value will be places at the path. In the above example, the distance between the input and center coordinates will be placed at the data.distance.work path.

The node also has the ability to optionally add which branch out of the node was taken to the payload. If a path is defined, true or false will be placed at the given path, depending on which branch out of the node is taken. In the above example, the branch taken will be placed at the data.geobranch.work path.

So, for example, given the following payload:

{
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "data": {
    "location": "$GPGLL,3906.72686,N,8430.74572,W,231131,A,*2a",
    "distance": {
      "home": 1654
    }
  },
  ...
}

The payload after execution of the geofence node would look like:

{
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "data": {
    "location": "$GPGLL,3906.72686,N,8430.74572,W,231131,A,*2a",
    "distance": {
      "home": 1654,
      "work": 34
    },
    "geobranch": {
      "home": false,
      "work": true
    }
  },
  ...
}