Skip to main content

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!

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.


@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?


Reply