cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Alerts with Geofence

RMG1
Guest

Creating Alerts with Geofence

Hi,

I have created to show a Geofence using Google Map Widget Extension in ThingWorx. However not sure, how to create alerts by linking it to a moving object.
Please note, I have already checked the Axeda integration with ThingWorx at the below link, but clueless on what do do from TWX Composer.
https://community.ptc.com/t5/IoT-Tech-Tips/Axeda-All-about-Geofences/td-p/532750

Appreciate a response.

 

Thanks

 

2 REPLIES 2

Re: Creating Alerts with Geofence

Hi @RMG1 

 

To check whether the current location is inside or outside geofence, you can use function "containsLocation" from snippets.

 

Regards,
VR

 

 

Re: Creating Alerts with Geofence

Hello,

 

If you use circular geofences, this is probably the most out-of-the-box way to get an Alert:

 

  1. Create some location property (of type LOCATION) on your Thing (ThingTemplate);
  2. Add an Alert to this property. Use "Deviation Below" and "Deviation Above" as Alert Type, to detect getting in and out of geofence, respectively. When you select those alert types, you can also specify the geofence center and its radius. Don't forget to put some overlap on the radiuses as some sort of hysteresis, to avoid getting into the situation when your alert turns on and off while the location fluctuates around the border;
  3. Once you added Alerts for entering and exiting your geofences, you can subscribe to those by creating the corresponding Subscriptions (either on the same or on another thing). This is where you can put some business logic that should fire when the alert occurs;

Step (2) is something you can do programmatically (see AddOrUpdateAlert generic service), i.e. you can CRUD your geofence alerts from your services, no need to do it in the Composer.

 

We tried this method on one of the previous projects, and it worked well until we started encountering high volume of sensor data, after which it started generating intermittent errors, which were hard to debug. However, at that time we used ThingWorx 7.x, I guess it got better since then, so that still may be the viable way to go. At the end of the day we rewrote it with the following approach:

 

For the arbitrary geofences you will need to use the service suggested by @Velkumar in a DataChange subscription. It will probably be less performant (more math needs to be done), and you'll lose the (very useful) Alerts capability, but at the end of the day we found it somewhat more reliable.

 

/ Constantine

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.