2

In QGIS 3.8.2 I would like to split line into equal segments. The issue is, that v.split splits the line into the required segments, except the last segment.

I would like to split the line into equal segments, but with the first and the last segment to be equal length. Any ideas?

  • 1
    Do you want to split by line length or by number of segment parts? – ahmadhanb Sep 16 at 10:06
  • By line length ... – Jordan Sep 16 at 11:21
  • Have you tried v.split.length? You can refer to this answer: gis.stackexchange.com/questions/297634/… – ahmadhanb Sep 16 at 15:24
  • I cannot find tool v.split.length, I can see only v.split tool. But anyways, it split the line to equal segments, with the last one shorte. For example if the line is 55 m, and my goal is to have 10m segments, then it gives 5 segment of 10m and the last segment is 5m. I would like to get 5 segments of 10 m and 2 segments of 2.5 m. – Jordan Sep 17 at 3:16
  • I think that this will be probably possible only with a python script. The script description would look like this: All lines to be split into 100m long segments; If the last segment (X) is > than 50m => keep the value (=X); If the last segment (X) is < than 50m => divide this segment by 2 (=X/2) => add up X/2 to the first and last 100m long segments (=100+X/2). Is there any simple way, how to write such script? I cannot find any guidline for noob coders. Thanks! – Jordan Sep 19 at 7:11
1

Suppose that I want to divide line layer of following image in 5 equal segments.

enter image description here

In attributes table, it was calculated with geometry options of field calculator, total line length and each equal segment length (5 in total).

Afterward, I opened v.split tool and filled following options:

enter image description here

After click in Run, I got Split by length layer where it can be corroborated (after updating length field) that v.split worked as expected. In following image was selected third feature.

enter image description here

  • This only makes the seqments equal, not based on required segment sength. I wanna have segments for example 10m long and the first&last equal. – Jordan Sep 17 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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