11

I'm new to QGIS, and have what seems like basic requirements; however I'm struggling to find a solution. I have GPS data in excel showing start and end points of a boat survey. In a row, it has start x, start y, end x, end y.

I would like to plot these points on a map, and draw a line between each start and end point, but without drawing lines between points in different rows.

I've seen a few similar questions in the forums, but none of them seem to work when I try. Points to path seem to plot lines between rows, and only used one point per line, rather than the two required. I've also seen WKT mentioned, but I don't know how this works.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
James Robbins
  • 111
  • 1
  • 1
  • 3
  • Have you tried "QGIS: creating lines from starting to arrival points?": https://gis.stackexchange.com/questions/34633/qgis-creating-lines-from-starting-to-arrival-points – BERA Jul 10 '17 at 08:56
  • ... or https://gis.stackexchange.com/questions/15909/workflow-for-creating-line-features-between-two-coordinate-pairs-in-qgis and https://gis.stackexchange.com/questions/194302/qgis-how-to-draw-lines-from-two-points-in-a-csv and https://gis.stackexchange.com/questions/64744/how-to-draw-lines-from-two-points-in-a-csv – AndreJ Jul 10 '17 at 09:28

1 Answers1

13

You might like the following process. Be aware it doesn't create a physical line layer in a different shapefile but a visual line layer from your data only visible within your QGIS project.

  • Load in your table data (via the Spreadsheet Layers plugin for example), and make the point geometry from the X and Y start column.
  • For the moment you will have your starting point data on screen.
  • Right click on the point layer and go to properties
  • Open the Style tab
  • Choose Single symbol, then geometry generator

Geometry generator

  • Choose LineString type in the list
  • Enter the following command, X_Start, Y_Start, X_End, Y_End being your 4 start and end fields :

    make_line( make_point( "X_Start","Y_Start"),make_point( "X_End","Y_End"))

Line generator

Instead of seeing point, you will see lines going from the starting point to the end point.

gisnside
  • 7,818
  • 2
  • 29
  • 73
  • For the curious, this method can be re-used to create a line between a label with data defined coordinates and the source entity (between $x/$y and X & y label fields. – gisnside Jul 11 '17 at 07:06