Skip to main content
Solved

Group features by an ID and within 5 minutes of each other


I'm trying to figure out how to group features based on a matching ID value and only if they have a date/time within 5 minutes of each other. For example, if I have two traffic jam features that both have the same road ID (they occur on the same stretch of road), with one happening at 12:15 pm and the other happening at 12:18 pm, these features would be considered a match and their attributes would be combined (total delay time added together, etc.). If on the other hand one had been reported at 12:15 pm and the other was reported at 12:30 pm, they wouldn't be aggregated.

 

So far, I have tried using the Aggregator transformer but it's only able to group by attributes where the values are distinct which only works for the street ID part of my example and not the time part.

 

Any suggestions would be extremely helpful.

Best answer by hkingsbury

Something i've had a good success with when deal with dates/times is to convert them all to epoch time, then use the epoch time in a vertexcreator as the x value and set the y value to '0' (replace current geom). Then you'll have a bunch of points to do spatial operations on.

Because epoch is in seconds, you can then use spatial operations to group based on a distance of 300 (5 minutes)

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

2 replies

hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • Best Answer
  • May 12, 2021

Something i've had a good success with when deal with dates/times is to convert them all to epoch time, then use the epoch time in a vertexcreator as the x value and set the y value to '0' (replace current geom). Then you'll have a bunch of points to do spatial operations on.

Because epoch is in seconds, you can then use spatial operations to group based on a distance of 300 (5 minutes)


nielsgerrits
VIP
Forum|alt.badge.img+54
hkingsbury wrote:

Something i've had a good success with when deal with dates/times is to convert them all to epoch time, then use the epoch time in a vertexcreator as the x value and set the y value to '0' (replace current geom). Then you'll have a bunch of points to do spatial operations on.

Because epoch is in seconds, you can then use spatial operations to group based on a distance of 300 (5 minutes)

Ha, nice one. Learned something new today.


Reply


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