Skip to main content
Solved

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

  • May 11, 2021
  • 2 replies
  • 41 views

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)

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

hkingsbury
Celebrity
Forum|alt.badge.img+65
  • 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+62

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.