4

I extracted vertices using 'Extract vertices' in Processing Tool. But so many unnecessary vertices extracted, so I want to remove them. What I want to leave is at the beginning and the end of the line. How can I remove those vertices in the middle of the line? I would like to know if there is a way to erase it all at once because there are so many things like that.

Vertices are in the same layer.

enter image description here

I want to remove all the blue vertices like the picture below.

enter image description here

Taras
  • 32,823
  • 4
  • 66
  • 137
jin
  • 169
  • 6
  • 1
    Can you please share a piece of your data with us? – Taras Dec 28 '20 at 11:28
  • @Taras How can I share these data? – jin Dec 28 '20 at 11:36
  • 1
    For instance here: https://wetransfer.com/ – Taras Dec 28 '20 at 11:36
  • 2
    @Taras Thank you. Here is the shape file https://we.tl/t-WLoSZ2P7wt – jin Dec 28 '20 at 11:41
  • 4
    If you remove the vertices of a curve, it will no longer be a curve, but a straight line, so you after representation is wrong. – Vince Dec 28 '20 at 13:44
  • 3
    As Vince commented, you can't have just the endpoints and keep the shapes. If you want to keep your basic shapes but get rid of "unnecessary" vertices, then you could run the Simplify tool in Processing, or (my preference) the v.generalize tool in GRASS's Processing tools, if you have GRASS as part of your install. You can play with the tolerances to see how much shape change and vertice losses you are willing to accept. – John Dec 28 '20 at 14:38
  • You guys are right. The result will be a straight line. I just drew the picture like that to help understanding because I'm not good at English. Thank you for your comments and I'll try installing GRASS. – jin Dec 28 '20 at 16:51

1 Answers1

1

From the QGIS Toolbox:

  • choose Extract specific vertices
    • in the Vertex indices field, specify the first and last vertex index as comma-separated list:
      0, -1

This will create a layer with the start and end vertices only, rather than excluding them from your result set.

geozelot
  • 30,050
  • 4
  • 32
  • 56
  • Thank you for answer but those lines are all made up of one, so if I extract the vertices like that, only two vertices are extracted.. – jin Dec 28 '20 at 11:25
  • 2
    The problem with your data is that all your lines are one single feature. You should first split somehow these lines to separate features - thus you should know what criteria to apply for splitting them. Maybe it would help to tell us what your final goal is, what you want to use these vertices for. – Babel Dec 28 '20 at 12:22
  • 2
    Once you have your lines split, its easy to create start- and end points, see: https://gis.stackexchange.com/a/383032/88814 – Babel Dec 28 '20 at 12:31
  • @babel Thank you for comment. My goal is just to extract vertices at the line deflected or crossed. – jin Dec 28 '20 at 17:07
  • As far as I see, this is not so easy as long as you do not manually create split lines. What does "deflect" mean? In the curve segments (exactly where you have many vertices to be deleted), the line always deflects. So in my opinion, it involves some manual work to create single lines. However, I still don't understand what you need these vertices for: as mintioned in other comments, you can't use them for a simpler line. If you would explain us more in detail what your ultimate goal is with these vertices, than maybe there is an easiere solution. – Babel Dec 28 '20 at 20:41