Skip to main content
Solved

create time segments

  • October 28, 2024
  • 7 replies
  • 60 views

robert_punt
Contributor
Forum|alt.badge.img+6

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

nielsgerrits wrote:

First groupNumber = 1.

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

Else previous groupNumber + 1.

Attached sample demonstrating this.

 

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

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

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+53
  • Celebrity
  • October 28, 2024
nielsgerrits wrote:

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+6
  • 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+54

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+54
  • Best Answer
  • October 29, 2024
nielsgerrits wrote:

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+6
  • Author
  • Contributor
  • October 29, 2024

@nielsgerrits 

this example is great. thank you very much.🤗

 


nielsgerrits
VIP
Forum|alt.badge.img+54

Cheers :)


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