0

I have a polyline which consists of just one geometry. I have points which are evenly spaced (25m). How would I add these point vertices to the line so that the points will create one line segment/polyline per point vertex?

This is so that I can have an attribute for the polyline each 25m so I can use it for labeling.

I am using QGIS. enter image description here
enter image description here

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Linkinpark
  • 373
  • 1
  • 6
  • 1
    Wondering how you got this points? Using "Split with lines" (in "Vector Overlay" section in the "Processing Toolbox") you can generate a new layer resulting from splitting your line in multiples segments of each 25 meters without going through your method with points. PS: I don't know you intend, so not sure it can be a "right" answer. Alternative could be using solution from https://gis.stackexchange.com/a/311374/638 – ThomasG77 Feb 05 '20 at 21:49
  • Sorry for the wrong picture. I used qchainage to get the interval and it outputs point. The tool you suggested only works if I have a nother polyline layer to split it with. – Linkinpark Feb 06 '20 at 06:44
  • I will look in the links you guys provided. I just added a picture to clarify (not good with all the terms yet). The yellow line is the original and is one segment. I want the segment to be split just between the points so I don't get a segment where the x mark is (where it is turning). – Linkinpark Feb 06 '20 at 07:40
  • Combined processing from my first comment and use the recipe from https://gis.stackexchange.com/a/331496/638 to generate lines with only start and end points – ThomasG77 Feb 06 '20 at 09:56

1 Answers1

1

An easy way to do this is to use the "Snap geometries to layer" tool from the Processing Toolbox with the following options:

  • Input layer: the polyline you want to add vertices to
  • Reference layer: the layer containing your points
  • Behavior : "Prefer closest point, insert extra vertices when required"
  • Tolerance : typically something small enough (for instance 0.1m) so that no existing vertex on the polyline would fall within the search distance for snapping.

This will make sure that all the existing vertices on your polyline are kept and that new vertices are added in the location where points from your other layer are.

Sken2107
  • 211
  • 1
  • 4