Feature request #5606

Defining column types for CSV imports

Added by Kenton Ngo almost 5 years ago. Updated over 1 year ago.

Status:Open Start Date:05/16/2012
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Delimited Text Data Provider
Target version:Future Release - Nice to have
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

At work we use Mac OS X. Microsoft Office for Mac no longer supports DBF exports, and much of our data that we'd like mapped lives in Excel-compatible files.

I'm currently exporting as CSV using this workaround, but it requires me to create a CSVT file, an annoying extra step. http://underdark.wordpress.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/

Is there any way to eliminate this extra step by allowing a user to define the column types at import?

History

Updated by Paolo Cavallini over 4 years ago

  • Target version set to Version 2.0.0

Updated by Pirmin Kalberer over 4 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

Updated by Karolina Alexiou about 2 years ago

I will work on this. Longs getting casted to floats from csvs has been an inconvenience for a while. Plz somebody with permissions assign this to me, thanks.

Updated by Matthias Kuhn about 2 years ago

Can you add a short description about your plans. Which datatypes exactly do you want to support (Int/Long/Float/Double) and will there be auto-detection of some kind of these types or what is the workflow?

Updated by Karolina Alexiou about 2 years ago

The workflow would be to allow the user to force a data type for 1 or more columns. Basically I am thinking of adding another row to the UI when importing delimited text layer where the user would be able to select Int/Long/Float/Double/String or Autodetect(default). Right now there is autodetection, but it doesn't always work right. I could also see if there is some obvious improvement to be done in that.

Updated by Giovanni Manghi about 2 years ago

  • Platform deleted (Mac OS X)
  • Platform version deleted (1.9)

Updated by Jukka Rahkonen about 2 years ago

Perhaps you could use ODS format instead? GDAL and Excel both can read and write the format http://www.gdal.org/drv_ods.html.

Updated by Karolina Alexiou about 2 years ago

Not really applicable to us, we just want more control over importing raw text files (unlike the original poster).

Updated by Karolina Alexiou about 2 years ago

https://github.com/qgis/QGIS/pull/1957

I made a pull request to QGIS upstream which improves the autodetection by also adding long types.
No work yet on forcing the type from the import menu.

Updated by Médéric RIBREUX over 1 year ago

  • Category set to Delimited Text Data Provider

Hello, bug triage...

the PR has been merged.

One good idea (on the GUI part) would be to try to make the delimited text provider act like LibreOffice Calc csv importer:

  • there is a QComboBox with the list of each type.
  • When you select a column, you can use the QComboBox to define the type of the selected column.

We just need a way to display the manually defined type of columns (upper or above the column name), but I am sure it's feasible.

Also available in: Atom