Skip to main content
Solved

Calculate the time spend inside area (Time-aware geofencing)

  • April 27, 2023
  • 2 replies
  • 76 views

siriosus
Contributor
Forum|alt.badge.img+4

Hello friendly FME Community!

 

I'm trying to implement a GeoFencing service which will calculate the time spent by vehicles in particular areas.

 

In short, I have a set of points (with timestamps) and set of polygons (geofences) against which I want to calculate how long these points were inside these polygons. 

 

I did make a workspace which does this using SpatialFilter (which identifies if points were inside polygons) StatisticsCalculator which calculates min and max timestamps and DateTimeCalculator which calculates the interval between this min and max timestamps.

 

The problem is that vehicle can move out of all polygons and then get back which will distort the calculation as the period that vehicle was outside the polygon will be included because last timestamp will be inside the polygon.

 

Is there any trick or technique in FME which allows to follow up these gaps and exclude them from calculation described above?

 

Thank you in advance for any suggestions!

Best answer by gazza

With points sorted by vehicle and timestamp and a flag set by the SpatialFilter indicating which polygon it is in you can use the Enable Adjacent Features function of the AttributeManager to get the previous status and compare it to the current status.

If it is the first time in a new geofence then set an attribute with that time and carry that forward.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • Best Answer
  • April 30, 2023

With points sorted by vehicle and timestamp and a flag set by the SpatialFilter indicating which polygon it is in you can use the Enable Adjacent Features function of the AttributeManager to get the previous status and compare it to the current status.

If it is the first time in a new geofence then set an attribute with that time and carry that forward.


adam.gwent
Participant
  • Participant
  • July 28, 2023

@siriosus​ - I've been tasked with something similar in regards to geofencing.

Out of interest, are you able to share a redacted copy of your workspace?