Geofences allow developers to color parts of the map and determinate events in specific areas.

To create a geofence, go to Advanced options in your widget's configuration. Then, set the option Allow users to edit geofence to yes. You can choose to allow users to create polygons, circles or both, and even select the number of geofences allowed in the map.

The maximum number of geofences allowed is 10.

You can also set the title of the geofences, in the field Title for the pop-up window display in all geofences.

The title will be shown in all of the geofences' pop-ups, like so:


Events

You can add events to geofences. To do so, head over to the Advanced Options tab in the map's edit configuration. For each event, you must set an event code so it can be identified in the analysis, and a description which is what the users will see. You can also set a layer color, this color will change the color of the geofence itself.

The geofences will be saved in a bucket, this way developers can manage them easily, to display the geofences on the map, select the bucket, device and variable

After setting up the options, you are all set to create the geofences, so go to the map widget. To add, edit and remove polygons and circles, use the tools located on the top right of the map.

After creating a polygon or a circle, select the event for that area and save.

When users create new geofence areas, they will be saved in the previously selected variable with the following format, notice that you will have the coordinates of the polygons in the variable's metadata.

{
  "id": "5b75c8ccdf9a8e00017f1488",
  "variable": "fence",
  "time": "2018-08-16T18:54:24.000Z",
  "origin": "5b758f096319ee0001f9d570",
  "value": "",
  "metadata": {
    "id": "l1w5r37clqwnk4ntf1rpjx16u1cff1wr5tgt",
    "color": "#00FF22",
    "geolocation": {
      "type": "Polygon",
      "coordinates": [
        [
          [42.300325960559654, -85.63790805637836],
          [42.305971081721594, -85.63798734918238],
          [42.30593698760671, -85.62895853072405],
          [42.29844438901512, -85.62885962426662],
          [42.298453564525126, -85.63375599682331],
          [42.30022652075572, -85.63364267349243]
        ]
      ]
    },
    "event": "area_4"
  }
}

Also check out