Using QGIS 3.2, I can use the "Extract Vertices" tool to generate a layer of vertices for each line segment in my data. My data is split into line segments of between 400-500m in length (using the v.split command). Since the geography is not straight, the tool extracts numerous vertices for each line segment:

enter image description here

For example, the selected line segment in red has 5 associated vertices. Is there a way to keep only the endpoints of each segment? I can use the fact that "vertex_part = 0" to find one endpoint, but since my line segments vary in distance I'm not sure how to easily pick out the other end.

  • both, start and end points? with attributes of the parent line? – ThingumaBob Sep 19 '18 at 14:37

You can use Extract specific vertices tool to extract the endpoints by inputing 0, -1 at the vertex indecies as you can see below:

enter image description here

The tool is located in Processing toolbox -> Vector geometry -> Extract specific vertices tool.

The input is a polyline composing of several segemets

enter image description here

Using the above tool with -1 index provides the endpoint only:

enter image description here

  • 1
    and use 0, -1 for both start and end points – ThingumaBob Sep 19 '18 at 14:48
  • @ThingumaBob that is right, however, since the OP asked for endpoint, I used -1 – ahmadhanb Sep 19 '18 at 14:49
  • 2
    I know, just as an addition...I just kind of read that question as if OP askes for both...(I was writing the same answer but you we're faster...wanted to share my 2 cents, too ,) ) – ThingumaBob Sep 19 '18 at 14:51
  • 1
    @ThingumaBob You are right, I have just noticed that he wanted both endpoints. I updated my answer. Thank you. – ahmadhanb Sep 19 '18 at 14:54

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.