3

I have recorded flight paths of birds as lines. Now I want to transform the lines to points, which represent the bird's position in a minute interval. For this, I want to divide the lines by the time I have observed the flight.

So a flight track I could watch for 5 minutes I want to divide into 5 parts, a track I have watched for 3 minutes, I want to divide into 3 parts and so on. Afterwards, I take the middle point of these segments as the flight position in the respective minute.

My first approach was to calculate the length of the segments ($length/minutes) and store the information in a new field (=segment). Afterwards, I used the plugin 'Station lines' to set lines after each segment. Then I used the QGIS tool 'Divide lines with lines'.

First it seemed to work, but then I realized that the function also cut the line at every self- intersection. As the flight tracks contain many loops I ended up with far more segments as expected.

Does anybody know a simple and safe way to split lines into proportional parts?

1 Answer 1

2

For each line, calculate the desired length of the segments, eg for a 5 minute line:

(total line length) / 5

You can make this calculation by using the field calculator to add a new field with the formula:

$length/"time"

where "time" is an existing field that represents how long you spent making the observation.

Use the points along geometry tool to add points along each line a specified distance apart. This "specified distance" is the segment length you calculated above. Unfortunately this tool doesn't allow you to enter an expression using the "segement_length" attribute. You have to enter the segment length value manually.

Use the tool split lines with points to split the line with the points.

Repeat for each line.


Note: this method works well for a small number of lines, up to 20 or so. If you have many lines, say in the hundreds or thousands, this method will be very time consuming. In that case you may want to try to automate the process with the Graphical Modeler.

2
  • Thanks for your hint. But as you mentioned, the tool "points along geometry" does not allow to enter an expression like "segment_length". I have a few hundred records. So it would be a tedious task. As a workaround I now used the extension QChainage. This extension places points at the start and end of a specific number of segments along a line. So I selected all flights of 2 minutes duration and divided the lines in 2 segments. Then I selected all fligths of 3 minutes divided it in 3 parts and so on. It is still not very practical but acceptable as most flights are shorter than 10 minutes.
    – user128020
    Sep 27, 2018 at 7:37
  • 2
    If you found a solution please post it as an answer to help others with the same question.
    – csk
    Sep 27, 2018 at 16:07

Your Answer

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

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