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.

2

1 Answer 1

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.

1
  • 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
    Commented Jul 11, 2017 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.