1

This question is a follow up on @Babel's answer to Interpolating points with QGIS native Temporal Controller.

Having successfully implemented the aforementioned method, as seen here:

enter image description here

I would like to apply this method but following along a certain line contained in a different layer. For example, on the previous gif, between points 8 and 9, or between points 4 and 5, starting from the bottom right hand side, we can see the interpolated point moves diagonally from one point to another. Ideally, it should continue and follow the tracks, making the appropriate turns to the next stops.

How would we tell the point to follow a certain path between two points?

2 Answers 2

2

A different approach but with the result you asked for:

  1. Get your lines and make sure they have an start-datetime and end-datetime attribute
  2. Open "Interpolate DateTime along Line" processing tool from ProcessX-Plugin
  3. Set a maximum line length you wish and run the tool
  4. Either now display the lines with temporal controler, or if you want points continue with 5.
  5. Extract a point on the line; this can either be start- or endpoint (use "Extract specific Vertices" with 0 or -1 as index), a simple centroid (use "Centroid") or all vertices (use "Extract Vertices"). Calculate points along the geometry (use "Points along geometry") or calculate the real centroid along the line using the expression line_interpolate_point($geometry,$length/2) either via geometry generator or "Extract by Expression".

Disclaimer: I am the author of Interpolate DateTime along Line tool

1

The linked solution is based on creating a part of a line, depending on how many time has elapsed. To get a part of the line, the function line_substring() is used. The substring that is created is based on the varible @line. This variable is defined as the line connecting each point with the next point. This is the part of the expression that defines the line:

with_variable (
    'line',
    make_line (
        $geometry,
        geometry( get_feature_by_id (@layer, $id+1))
    )
)

In the above expression, replace the make_line () part (lines 3 to 6) with the very line you have. Then the function should work as you want.

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.