You can now setup a geofenced trigger for a data stream containing latitude/longitude coordinates. Whenever an asset enters or leaves the programmed geofence, set by a latitude/longitude coordinate center plus a specified radius, a trigger action will fire. This post goes through a step-by-step example of setting up a geofence and testing trigger alerts by sending location data through URL parameters.
Click the +Cloud icon in the bucket shelf to create a new, empty data bucket.
Two keys are needed to stream data into this new data bucket, the bucket key that you choose (or use the one generated for you) and your access key. Click the “Configure Endpoint Keys” checkbox to set these keys.
After the bucket has been created, click on the settings link under the data bucket name on the bucket shelf. The API endpoint URL is located in the data tab. The URL will look something like this but with the bucketKey and accessKey you chose in Step 2:
Go to Google Maps (or the map of your choice) and search for a specific location. The latitude/longitude coordinates will be located in the URL. For example, the coordinates for Bridgestone Arena in Nashville, TN are 36.1591779,-86.7806846.
Open up a new tab in your browser. Paste the API endpoint URL from step 3 into the address bar. Add
to the end using the latitude/longitude coordinates from Step 4. Hit Enter to send the data point.
Click on the Tiles app to see the data point drawn on an automatically created map tile. This point should correspond to the location selected in Step 4. If a new tile isn’t drawn automatically or if the tile isn’t drawn as a map by default, something went wrong in Step 5.
Click on the Triggers tab under the data bucket settings. Set the Signal Key to myLocation, the trigger operator to “exits”, the radius (km) to 1, and the location to the latitude/longitude coordinate from Step 4. Click the ‘+’ icon to add the trigger condition.
Choose the trigger actions to take when the condition is set. Add email and/or SMS alerts and click the ‘+’ to add each alert.
Drag the Google Maps location to get new latitude/longitude coordinates. Send each coordinate via URL parameters as in Step 5. Once a coordinate has been sent that is greater than 1 km from the geofence center location, your trigger actions will fire.
A preview image containing the geofence center location and the location that triggered the alert will be sent via a URL (e.g. https://init.st/lww6h1u) in the SMS.
A similar email message will be sent when the geofence trigger fires.