2

I'm trying to populate a value map in the edit widget with some values from a csv file.

Could anyone let me know what format the csv file has to be in? At the moment I have just a list of comma-separated values (in UTF-8 if that matters), but when i click on 'Load data from CSV file' and browse to the relevant file, nothing happens.

I am using QGIS 2.6.

2

I did a test by saving a simple text file in 4 different encoding formats:

  • ANSI
  • Unicode
  • Unicode big endian
  • UTF-8

I then took the above text files, imported them into Microsoft Excel (by dragging the text file), saved these as .csv files and tried to load them into the Value Map widget.

Interestingly, only the data from the ANSI and the Unicode csv files were loaded, the other 2 did not. I don't think the formatting has any effect, if you have multiple columns of data then QGIS will use the first column as Value and the remaining columns will be joined in the Description with each data separated by a comma.

Note that the first line of data in the csv file is ignored when loading it into the widget (perhaps QGIS assumes the first row is used as a header?). So I guess, at the moment, it does matter which encoding you use (I also used QGIS 2.6 to test this).

  • Plain Unicode worked for me too, thanks. A strange bit of behaviour as all my csv joins are in UTF-8 and qgis seems to handle them fine. Anyway, problem solved. – Isaacson Dec 4 '14 at 16:52

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.