3

Is it possible in QGIS to create lines from a table storing the X,Y-coordinates of starting and arrival points, so that a line.shp is automatically created? Or does a plugin exist to achieve that?

nmtoken
  • 13,355
  • 5
  • 38
  • 87
philmyer
  • 307
  • 1
  • 4
  • 10
  • 2
    Possible duplicate question http://gis.stackexchange.com/questions/15909/workflow-for-creating-line-features-between-two-coordinate-pairs-in-qgis – Rayner Oct 01 '12 at 11:41
  • @Rayner Thank's a lot :) Due to the large table I decided to use the way proposed by nhopton (see below). Best regards, phil – philmyer Oct 02 '12 at 11:31

1 Answers1

5

You could make a text file something like that shown below.

Geom|Name
LINESTRING (401835.463 143853.834, 402685.304 146873.003) |Line 1
LINESTRING (401276.358 148382.588, 403367.412 144994.409) |Line 2
LINESTRING (403870.607 149646.166, 399487.220 141069.489) |Line 3

Add the file to QGIS: Layer -> Add Delimited Text Layer. Click the 'Plain characters' radio button and enter the 'pipe' character | in the box. Click the 'WKT' radio button and select 'Geom'. When the lines load set the CRS of the layer. Then save the layer as a shapefile :)

N.

nhopton
  • 6,983
  • 1
  • 19
  • 36
  • Thank's a lot :) I will use this approach. Best regards, phil – philmyer Oct 02 '12 at 11:33
  • This worked for me for a different thing I'm doing - visualising an OD matrix with 10 million rows - fast like a charm in QGIS to import as WKT. My alternative option of ArcGIS Pro "XY to point" takes forever. I haven't tried to import as WKT to ArcGIS. – Lizardie Dec 06 '21 at 09:53