Send email notification by calculating the time difference

825
2
08-17-2020 11:01 PM
nasserhinai
New Contributor II

Is it possible to calculate the time inside geofence starting from enter the geofence until exit?

Then send an e-mail if this take 2 minutes or more inside the geofence ?

For example : The Car " 1 " enter the geofence at 10:08:00 and stay inside the geofence until exit the geofence at 10:11:00 so in this case email contain the time spent inside the geofence should be send. 
And if this car exit the geofence at 10:09:00 the email should not be send.

Thanks.

0 Kudos
2 Replies
RJSunderman
Esri Regular Contributor

Hello nasser hinai

I think what you want to do is use an Incident Detector with an opening condition which determines an asset has "entered" and area of interest (registered as a geofence) and set the closing condition to evaluate true when the asset's location has "exited" the geofence.

The event record output from the Incident Detector will be an incident which has a very different schema from the event record you routed to the processor. While you'll lose a bunch of attributes from the original record, you will retain whatever field you tagged TRACK_ID and also GEOMETRY. The incident event record will also have a duration which you can pass through a filter. If the asset were to dwell within an area of interest for some time you could use a filter to check that:  (a) the incident's status is 'Ended'  (b) the incident's duration is greater than some value. Then whatever event records the filter allows to pass you send to an output configured to send an e-mail notification.

Hope this information is helpful –
RJ

nasserhinai
New Contributor II

Hi RJ Sunderman,

Thanks for the suliotion . I tried it and it is work but as you mention the output from the Incident Detector will has a very different schema which is not what I want.
to make my idea clear: I have IVMS data like ( driver name, plate number, long.lat and department ) this data should be writing on e-mail when the car enter restricted area  (geofence) - and this is easy to do.

Now what I want is to calculate the time that car spend inside the geofence since the car entring until it exit the geofence (duration) and write this info in e-mail as well with other IVMS data.

Thank you again.

Regards,

Nasser