Skip to main content
Solved

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


Forum|alt.badge.img

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.

View original
Did this help you find an answer to your question?

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?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings