I have a data set with a large number of start and end positions. I am trying to generate lines between start and end positions using the Geometry Generator but it does not work. I get no errors when running it, but the lines do not appear. I have found several answers to a similar qestion, e.g. this one, : Creating a line from two points in QGIS I select geometry Type as "LineString. Here is the code I have been trying to use. make_line(make_point("shootlon" ,"shootlat"), make_point("haullon", "haullat"))

enter image description here

Small screenshot of the data, which is a text ("txt") file.
What could be the problem? Some of the older plugins e.g. "Points2one", do not work in QGIS 3.4.4.

  • Welcome to GIS.SE. Are your points displayed properly? – Erik Mar 13 '19 at 10:45
  • Thanks. Yes, they are displayed well. The strange this is that the layers show the line symbol in front of the variable for few seconds but then disappears. – Stefán Áki Ragnarsson Mar 13 '19 at 10:47
  • I don't know what you're doing, but the first two rows of your data work fine with your code. Check the symbology and whether your layer is visible or not. – Erik Mar 13 '19 at 10:56
  • Thanks Erik. I also tried with the first two lines and it does not work. In the symbology it says I have created a line but he line is not visible. – Stefán Áki Ragnarsson Mar 13 '19 at 11:21
  • 1
    Thanks.It works now. I use "quote = FALSE" in the R write table command, i.e." write.table(df, "C://x/x/df.txt", row.names = F, quote = FALSE) and get column headings wtithout quotation marks. – Stefán Áki Ragnarsson Mar 13 '19 at 12:13

This is how my attribute table looks like

enter image description here

This is the expression to use :

make_line(make_point( "Xstart" , "Ystart" ),make_point( "Xend" , "Yend" ))

enter image description here

Then press Ok

| improve this answer | |

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.