3

I used to import csv files in previous versions of QGIS using the format below, but when I upgraded to QGIS 2.0 the delimited text layer plugin was changed and I can't import the file anymore. The plugin can't also detect the x,y or long lat field unlike in previous versions. Any ideas how to add the file? Thanks

Format

Sample

Heres what it looks in Text Editor:

enter image description here

underdark
  • 84,148
  • 21
  • 231
  • 413
CES
  • 75
  • 2
  • 8
  • 1
    It's weird that the different values from same file are appearing in the spreadsheet program that you have, and in Qgis. Can you show us how the data looks in a Text Editor? You should also check the 'First record has field names' option while importing it to Qgis. – Devdatta Tengshe Oct 10 '13 at 08:12
  • 1
    I don't understand where the "Species" field_1 comes from, but it seems the linebreak in your data gets lost. Also, your decimal separator isn't a comma, but a colon apparently. Maybe this mixes things up? – SAnderka Oct 10 '13 at 08:21
  • Thanks @DevdattaTengshe for your prompt response. Please see above screenshot of the file in text editor. – CES Oct 10 '13 at 08:35
  • Thanks too @SAnderka! I don't know why the field looks like that, but the delimiter is a comma. Please see screenshot above. – CES Oct 10 '13 at 08:43
  • But your coordinates use a colon as decimal separator (you have '120.4833333', not '120,4833333'). What happens if you uncheck "Field optopons" > "Decimal separator is comma"? – SAnderka Oct 10 '13 at 08:54
  • Try using Custom delimers, and then use semicolon. – Alexandre Neto Oct 10 '13 at 08:55
  • @SAnderka nothing happens when I unchecked it. – CES Oct 10 '13 at 09:02
  • Thanks @AlexandreNeto! I used Custom delimiters > semicolon and field changed to "Species,Long,Lat SP1,120....,16.5...." – CES Oct 10 '13 at 09:05
  • Thanks for all your help guys! I really appreciate it. I will try to work this out on my Window machine. – CES Oct 10 '13 at 09:10
  • Hm. Unfortunately I only have good old QGIS 1.8 installed here at the office, and not 2.0 yet - otherwise I'd give your data a test run myself... – SAnderka Oct 10 '13 at 09:12
  • Do you have excel and open the text file in it...or copy and paste to it. use text to columes and import it from there. – Ger Oct 10 '13 at 09:15
  • Have you solved your problem? Your file is comma separated, and use colon as decimal separator. I would use the text editor to replace all "," to ";", and all "." to "," then I would use semi-colon separator, and it should work well. – Alexandre Neto Oct 10 '13 at 10:18

2 Answers2

2

The line breaks are in Classic Mac (CR); they should be in Unix (LF).

I fixed this by opening my file in TextWrangler and changing the line encoding in the save as screen.

Save as screen

Justin
  • 399
  • 1
  • 7
2

I think you have a problem with your text file (encoding ?)

The text file (not with TextEdit !)

enter image description here

The only thing I did is to fix X and Y fields

enter image description here

Result:

enter image description here

gene
  • 54,868
  • 3
  • 110
  • 187
  • You're awesome!Thank you so much. I encoded the data using microsoft excel (which I used to do), but when I encoded it using LibreOffice I was able to import it. – CES Oct 10 '13 at 16:27