12

I want to create start and endpoints in QGIS for a Linestring shapefile.

I tried using the "QChainage Plugin" but was not useful.

Can someone suggest a tool?

Image

Taras
  • 32,823
  • 4
  • 66
  • 137
Duffer
  • 453
  • 2
  • 5
  • 13

5 Answers5

21

If you have QGIS 3.4 you can use Extract specific vertices tool to extract the endpoints by inputting 0, -1 at the vertex indices 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 segments

enter image description here

Using the above tool with 0,-1 indices provides the endpoints only:

enter image description here

ahmadhanb
  • 40,826
  • 5
  • 51
  • 105
11

You can also use a Virtual layer (Data Source Manager > Virtual Layer) with SQL:

select id, st_endpoint(geometry) as geometry from lineshp
union
select id, st_startpoint(geometry) as geometry from lineshp
Jakob
  • 7,471
  • 1
  • 23
  • 41
  • The virutal layer query saves the start and end points in single colomn. Can we save them in two different coloumns? – Case Msee Feb 23 '21 at 01:00
  • Yes, but QGIS can only load one geometry column at a time, so you will only see either start or end point, if you drop the union clause. – Jakob Feb 25 '21 at 12:24
6

You can also use expressions start_point() and end_point() to create start- and endpoints of your lines. Use this expression to get both at once:

union (
    end_point ( $geometry ),
    start_point ( $geometry )
)

Paste this expression on an additional symbol layer on your line layer to create points for visualization purpose only (see screenshot) or create a new layer with actual point geometries using Menu Processing / Toolbox / Geometry by expression and using the same expression. enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
3

You can use the GRASS tool v.to.points for this. Select node and adjust minimum distance.

MrXsquared
  • 34,292
  • 21
  • 67
  • 117
2

Use these expressions in the attribute table:

  • x_min($geometry)
  • y_min($geometry)
  • x_max($geometry)
  • y_max($geometry)

As easy as that.

tomanuk
  • 31
  • 1