Feature request #5606

Defining column types for CSV imports

Added by Kenton Ngo over 5 years ago. Updated 6 months ago.

Status:Open
Priority:Normal
Assignee:-
Category:Data Provider/Delimited Text
Pull Request or Patch supplied:No Resolution:
Easy fix?:No

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

#1 Updated by Paolo Cavallini about 5 years ago

  • Target version set to Version 2.0.0

#2 Updated by Pirmin Kalberer about 5 years ago

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

#3 Updated by Karolina Alexiou over 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.

#4 Updated by Matthias Kuhn over 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?

#5 Updated by Karolina Alexiou over 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.

#6 Updated by Giovanni Manghi over 2 years ago

  • Operating System deleted (Mac OS X)
  • OS version deleted (1.9)

#7 Updated by Jukka Rahkonen over 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.

#8 Updated by Karolina Alexiou over 2 years ago

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

#9 Updated by Karolina Alexiou over 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.

#10 Updated by Médéric RIBREUX almost 2 years ago

  • Category set to Data Provider/Delimited Text

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.

#11 Updated by Giovanni Manghi 6 months ago

  • Easy fix? set to No

Also available in: Atom PDF