The simplest way is to use the points to create the line. To do this in QGIS use the Points2One plugin. Install this plugin (available via Plugins > Manage and install plugins
) and follow the dialog to create a line from your points.
If you have multiple lines, then make sure your points data has a suitable ID field to identify the lines they belong to.
Alternatively you can use v.build.polylines
in GRASS (available through QGIS) or the SAGA GIS tool Convert points to line(s)
Available through the Processing Toolbox (Ctrl+Shift+T).
The quickest way to do this with a single line would be using the QuickWKT plugin; you can then right-click and Save As to any format you need.
Let's say your two points are in UTM Zone 36S, and here are listed as x (easting), y (northing):
- 151930,9593414
- 184802,9587212
The WKT format for a line is:
SRID=SRID;LINESTRING (x1 y1, x2 y2, x3 y3, ...)
Thus, for the example above:
SRID=32736;LINESTRING (151930 9593414, 184802 9587212)
Pasted into the QuickWKT plugin text box:
For larger sets of data, you can make an Excel table into a geographic data type by building that WKT string into a column, i.e. (where A2-D2 contain two sets of XY coords):
=CONCATENATE("SRID=32736;LINESTRING (",A2, " ", B2, ",", C2, " ", D2, ")")
You can save from Excel as a CSV and then use the add delimited text in QGIS (with "watch file" selected to keep it updated).
Best Answer
One way to do this would be using a "Virtual Layer".
"X"
and"Y"
fields in your point layer containing the x and y coordinatesThis will create a Virtual Layer that will contain every combination of X,Y origin and destination coordinates. In my example I used 29 points thus resulting in a virtual layer of 841 points (29²).
Just for symbolization purposes the point layer can be symbolized into lines using a geometry generator expression:
To make a permanent layer I recommend using the tool XY to line from the plugin Shape Tools.