2

I have a dataset with time-stamped GPS points. I would like to calculate the time difference in seconds between these rows. I successfullymanaged to do so by running the piece of code below in the field calculator outside the graphical modeler. However, when I want to calculate the time difference with the field calculator in a graphical model, it does not work.. It only generates NULL values, except for row with id 0. I used the exact same code. Any ideas what the problem is?

CASE WHEN id=0 THEN 0
ELSE
second(age(attribute($currentfeature, 'datetime'), 
       attribute(get_feature_by_id('[layername]',$id-1), 'datetime')))
END

enter image description here

3
  • What is your output field type?
    – Erik
    Mar 26, 2020 at 15:30
  • The output field type is Integer
    – winecity
    Mar 27, 2020 at 9:04
  • What happens when you try string?
    – Erik
    Mar 27, 2020 at 9:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.