I have a point file, with Date:Time enabled. Rather than just animate the cycling through of points, I would like to have a line moving in a straight direction from one point to another in date order.

What would be the best way to go about this?

Based on Babel's answer I have tried the following:

with_variable (
    0,  -- change this value to add/subtract hours to/from attribute named arrival_time to transform local time zone to UTC
        Date_time + to_interval (@zone  || ' days'),
            attribute (get_feature_by_id (@layer, $id+1), 'Date_time'),
            with_variable (
                @map_start_time + to_interval ((second (@map_end_time - @map_start_time)/2 ) || ' seconds'),
                with_variable (
                    make_line (
                        geometry( get_feature_by_id (@layer, $id+1))

My data contains a Date-time column of the format YYYY-MM-DD HH-MM-SS. With a few exceptions all are set to 13:00:00 for the time, which is not so important. The only time this is different is when I have rows of the same day, and so would then control for them with different times.

  • 2
    See here: gis.stackexchange.com/a/438402/88814 Just leave away the end_point() function to get a line, not point moving
    – Babel
    Oct 23, 2022 at 15:34
  • @Babel, finally getting around to trying this, thanks for the help. My features are day by day so I have modified your code to the below, but not seeing anything? I've edited my original post. Oct 27, 2022 at 12:19
  • 1
    Difficult to say without seeing your data+project
    – Babel
    Oct 27, 2022 at 16:32
  • @Babel, I have added more description of my data in the first post. As far as I can tell I have set up my project as in the link you shared. Oct 27, 2022 at 18:04

1 Answer 1


I have a point layer with two fields :

  • id : unique integer field
  • dt_field : date time field, format yyyy-MM-dd HH:mm:ss

I just created a symbol layer for the point layer with geometry generator symbol type, linestring geometry type.

As geometry generator expression, I wrote the following code :

with_variable('data', array_agg("id", order_by:="dt_field"),
with_variable('id_index', array_find(@data, "id"),
with_variable('next_feature', get_feature(@layer, 'id', array_get(@data, @id_index + 1)),
    make_line($geometry, geometry(@next_feature))
  1. I created an array with id field values ordered by the Date Time field @data
  2. I retrieved the current feature id index position in the @data array
  3. I searched for the next Date Time feature, so the feature that is next in the @data array (or @id_index + 1) : @next_feature
  4. I created a line starting from the current geometry $geometry (use @geometry since QGIS 3.28) to the next feature geometry geometry(@next_feature)

With temporal controller activated and the point layer temporal settings sets on the dt_field, you can see the line moving through the time.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.