Skip to main content
Solved

create time segments

  • October 28, 2024
  • 7 replies
  • 90 views

robert_punt
Contributor
Forum|alt.badge.img+7

Hello,

 

i have a question for a scanner. the scanner drive through our city. the scannner makes a couple of rounds per day. But i have many record with a timestamp. between the rounds there is a time diffrent say 1 hour or more. 

how can i crerate a round number that the scanner makes.

for example the scanner start at 7.00 en ends at 10.00  (thats round 1) and then starts at 13.00 and ends at 16.00. (thats round 2) the next day is somewhat the same but the count must go on.

 

Beste Regards Robert

Best answer by nielsgerrits

First groupNumber = 1.

If DateTime difference is less then 60 minutes, groupNumber = same as previous groupNumber.

Else previous groupNumber + 1.

Attached sample demonstrating this.

 

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.

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+62

Not sure what you have. Do you have individual records with points and datetime stamps? If that is the case, you can sort the rows on datetime and then calculate the time difference between each record. If the time difference is greater then a treshold value, say 60 minutes, you can then start a new group number.

When I need this I first create it in Excel with formula’s. When I have what I want, I recreate this with an AttributeCreator with Adjacent Feature Attributes enabled and conditional values. If you need assistance / a sample give a shout.


hkingsbury
Celebrity
Forum|alt.badge.img+65
  • Celebrity
  • October 28, 2024

Not sure what you have. Do you have individual records with points and datetime stamps? If that is the case, you can sort the rows on datetime and then calculate the time difference between each record. If the time difference is greater then a treshold value, say 60 minutes, you can then start a new group number.

When I need this I first create it in Excel with formula’s. When I have what I want, I recreate this with an AttributeCreator with Adjacent Feature Attributes enabled and conditional values. If you need assistance / a sample give a shout.

Further to this, i’d look to convert your datetimestamps to epoch. This is measured is seconds and therefore makes it very easy to sort and find groups (you can turn them into ‘spatial’ points and see them grouped)


robert_punt
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • October 29, 2024

Thank you all for the answers, but i am still strugling.

In the image you see at record 271 that the timediffrent is 2 hours.but how do ik make the records before 271 as segment 1 and on 271 and above segment 2?

 


nielsgerrits
VIP
Forum|alt.badge.img+62

First groupNumber = 1.

If DateTime difference is less then 60 minutes, groupNumber = same as previous groupNumber.

Else previous groupNumber + 1.


nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • October 29, 2024

First groupNumber = 1.

If DateTime difference is less then 60 minutes, groupNumber = same as previous groupNumber.

Else previous groupNumber + 1.

Attached sample demonstrating this.

 


robert_punt
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • October 29, 2024

@nielsgerrits 

this example is great. thank you very much.🤗

 


nielsgerrits
VIP
Forum|alt.badge.img+62

Cheers :)