Geofences allow developers to color parts of the map and determine events in specific areas.
To create a geofence, go to Geofence 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 99.
You can also set the title of the geofences, in the field Geofence tooltip title.
The title will be shown in all of the geofences' pop-ups, like so:
You can add events to geofences. To do so, head over to the Geofence 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 variable, this way developers can manage them easily, display the geofences on the map, select the device and variable.
This is similar to the Data From field, from the Map Widget.
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, click on the pencil icon and use the tools located on the top right of the screen.
The geofence toolbox is composed by:
- Default tool: This allows you to zoom and drag the image;
- Draw polygon: With this tool active, you can click on the image and draw your geofence, when you click on the first drawn point, the geofence ends, and you can rename it and add an event on the right of the editor;
- Draw circle: With this tool active, you can click on the image at the center point of your circle, and click again on another point to select the radius size, when you click the second time, the geofence ends and you rename it and add an event to the right of the editor;
- Delete tool: With this tool active, you can delete the geofences by clicking on them.
Below the toolbox, you can find a list of all the geofences that are in the selected layer, and you can edit it by clicking on the geofence name.
Geofence variable data
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.