I want to keep an Excel sheet containing flight records. Then I want to use QGIS to plot the coordinates. I would like to keep all data for each flight on one line. Is this possible?

When I add a CSV layer it will only allow me to plot X and Y coordinates. Which in the case of my data is my origin airport. It will not plot the destination coordinates unless I put that data on a separate row using the same X and Y plots. What is the best way for me to organize my data?

CSV file format

2 Answers 2


QGIS has only one real geometry per feature. To get around this, the easiest way is to use the Geometry Generator.

Import the CSV using origin_laty and origin_lonx as the X and Y geometry columns. Your layer will now show the origin point. You can style it in the symbology settings as you wish.

Now add a new symbol layer in the symbology, and make the symbol layer type be Geometry Generator, geometry type LineString. In the expression window (where it probably just says $geometry as a default), enter

make_line( $geometry , 
    make_point( "destination_lonx" , "destination_laty" ) )

Go ahead and style this line symbol layer to show the connecting line.

Finally, if you wish, add a 2nd Geometry Generator symbol layer, of point type, with just the expression

make_point( "destination_lonx" , "destination_laty" ) 

To display the destinations.

If you felt like it, you could create a virtual field Destination in the field list using the Field Calculator, and use the make_point(...) expression to populate it, and then use it as an attribute in the above 2 symbol layers. This saves it being recalculated twice, and you could use it for other purposes too, but for a simple CSV layer is hardly worth the effort.

Editing to add: I see J.R answered in line with my answer while I was typing it. Keeping mine up since I explicitly wrote out the expressions, just in case that's useful.

Additional option. If the visibility issues J.R. mentions (and I've experienced too...) become a concern, you could also preprocess the CSV in Excel (or wherever) and create another calculated column there with the connecting line in WKT. See my answer at Creating multiple separate vector lines from list of coordinate pairs in QGIS


Your data are perfectly organised.

Just do as before then to get line from your start and end coordinate you could use :

  1. The geometry generator, this is for display only as the line are only created at the symbology level (see this answer for a good tutorial Creating a line from two points in QGIS. Note that if the start or end point are not visible in your extent the geometry generator may not display the line.
  2. The geometry from expression tool, by using the same expression as in the geometry generator (see point 1) in this tool you will create a line layer, this is good if you have a lot of line (the calculation are made only once and not at each redraw) or if you need the line for further analysis and it may solve display problem when point are not in view.

If you want to have symbol on the start or end point you could add symbol layer and use again the geometry generator with the make_point expression.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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