1

I’ve been trying to split lines with certain length to extract those vertices. Alt ought, when I try v.split and it creates a new shapefile, nothing is drawn and the attribute table is empty.

I had tried with QGIS 3.16.9, 3.18.2 and 3.20.3 in different machines, different shapefiles (with single and multiple lines), but it didn't work. My colleague did the same methodology in another occasion and it resulted well.

Any idea about what is the problem?

I didn't find any report about this. The Log Messages is not being helpful.

Attempt with the .shp I need.

Attempt with a simple straight segment.

5
  • Have you tried the native split lines by length tool? If so, what happens?
    – Erik
    Commented Sep 28, 2021 at 10:02
  • I tried. But it remains the same as the original shapefile, no split or added vertices. I've been trying with simple lines, but I will need to split lines (adding new vertices) that are tens of meters into segments of a few centimeters.
    – NunoR
    Commented Sep 28, 2021 at 10:11
  • 2
    Have you tried reprojecting your data? Although 3763 is supposed to use m as unit of measurement, maybe it doesn't work properly. Have you tried different parameters? Have you tried exploding (multi to singlepart) the lines first?
    – Erik
    Commented Sep 28, 2021 at 10:36
  • As an alternative you may try an approach described in this thread: gis.stackexchange.com/a/401228/99589
    – Taras
    Commented Sep 28, 2021 at 11:05
  • I haven't solved my problem. v.split still doesn't work even on single segments. Alternatively, I actually tried 'points along geometry' and got the vertices I wanted.
    – NunoR
    Commented Sep 28, 2021 at 11:34

1 Answer 1

1

To split a line in several segement of 50 m length each, use Geometry by expression with the following expression and then convert the output from Multipart to single parts:

collect_geometries (
    array_foreach (
        generate_series (0, length($geometry), 50),
        line_substring( $geometry, @element, @element+50)
))

Initial line (black) split up in 50 m segement (red) using the expression from above with Geometry generator:

enter image description here

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.