Sunday 25 December 2016

well known text - QGIS How to draw lines from two points in a CSV?


I have a largely identical query to How to draw lines from two points in a CSV?, however the solution listed isnt working for me.


My original text format is PID, Start Northing, Start Easting, End Northing, End Easting.


I've tried in excel to make into a WKT compatible format, i.e.


BL2990;LINESTRING(490206.73 214102.673, 490236.94 214134.576)


This works when pasting a single line into QuickWKT, however I can't paste multiple lines in...is QuickWMT intended for a quick preview of single objects only?


In terms of importing as a delimited text file, I have arranged as:


ID;GEOM


"BL2990";"LINESTRING(490206.73 214102.673, 490236.94 214134.576)" Etc, and saved as a .txt file.


When I import as delimited text and select ";" as delimiter, the import creates the 2 column headers but fails to split the data string into ID and Geometry fields. What am I doing wrong?



I've tested importing the .txt while excluding the ID header and ID text string which works fine, however it is critical that the lines retain their identifier.



Answer



Your data looks ok. In the Delimited text input form, the Geometry definition should be set to WKT, and the Geometry Field to the column containing the WKT. That way you get the linestring into QGIS.


If you change the name of the second column from GEOM to WKT, QGIS automatically sets the Geometry definition and Geometry Field to that column.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...