Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run the following test CSV through the Delimited Text plugin as WKT data:

oid,Line
1,LINESTRING((45.554194 -122.686101, 45.433001 -122.762632))
2,LINESTRING((45.432505 -122.598327, 45.423743 -122.592932))
3,LINESTRING((45.285959 -122.333998, 45.423743 -122.592932))
4,LINESTRING((45.548994 -122.514218, 45.519204 -122.679675))
5,LINESTRING((45.491189 -122.873493, 45.433001 -122.762632))
6,LINESTRING((45.380535 -122.743911, 45.397011 -122.79874))
7,LINESTRING((45.347019 -122.350363, 45.423743 -122.592932))
8,LINESTRING((45.582386 -122.689115, 45.536485 -122.65859))
9,LINESTRING((45.430841 -122.782667, 45.380535 -122.743911))

All I'm getting for my trouble is this error:

The layer file:///$PATHTOFILE?delimiter=%5B,%5D&delimiterType=regexp&wktField=Line is not a valid layer and can not be added to the map

I have to be missing something simple here, but I have no idea what it is, and Google hasn't been helpful. I'm using QGIS 1.8.0-Lisboa.

share|improve this question
    
csetzkorn: you are correct, it should be LINESTRING(long lat, long lat) I just confirmed it as I worked through some points in QGIS2.12.2-Lyon Using Lat and Long will create the lines to a different region than your existing shapes. – Resedu Mar 3 at 17:43
up vote 8 down vote accepted

There are two possibilities here (see http://en.wikipedia.org/wiki/Well-known_text for more possibilities):

  1. LineString - LINESTRING (30 10, 10 30, 40 40)
  2. MultiLineString - MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))

Currently you have LINESTRING and (( which is wrong.

UPDATE There is also a problem with the commas as Jason says, I managed to get the following to import (once I changed the delimiter to ;):

oid;Line
1;LINESTRING(45.554194 -122.686101, 45.433001 -122.762632)
2;LINESTRING(45.432505 -122.598327, 45.423743 -122.592932)
3;LINESTRING(45.285959 -122.333998, 45.423743 -122.592932)
4;LINESTRING(45.548994 -122.514218, 45.519204 -122.679675)
5;LINESTRING(45.491189 -122.873493, 45.433001 -122.762632)
6;LINESTRING(45.380535 -122.743911, 45.397011 -122.79874)
7;LINESTRING(45.347019 -122.350363, 45.423743 -122.592932)
8;LINESTRING(45.582386 -122.689115, 45.536485 -122.65859)
9;LINESTRING(45.430841 -122.782667, 45.380535 -122.743911)
share|improve this answer
    
Also, won't those commas in the LINESTRING trip it up and split it into multiple columns? Shouldn't the WKT be quoted? – Jason Scheirer Sep 27 '12 at 9:47
    
Make sure you view the file in a text editor, not a spreadsheet program. I use Notepad++ to Replace All and I remove the " s – Willy Sep 27 '12 at 20:36
    
The (( was an artifact from some other things I tried. I think the main issue I was having is indeed the commas. Thanks! – Pliny Oct 1 '12 at 17:31
    
Is the order of lats/longs not wrong here? – csetzkorn Dec 14 '15 at 10:32
    
that is definitely lat/long :-) – iant Dec 14 '15 at 10:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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