Bug report #12783

Import CSV via "add delimited text layer" ignores Date fields in CSVT

Added by Jeremy Kidwell over 9 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/Delimited Text
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:20882

Description

When importing a CSV file with fields defined in CSVT, QGIS ignores fields designated as "Date" and imports them as QSTRING / text. I have confirmed that my CSVT file is properly formatted and the import does make use of field designations for "Real","Integer","String".

Data samples as follows:

GIS-Locations_2.4.csvt:

"Real","Real","Integer","String","String","String","String","String","String","String","Integer","Real","Date","Date","Date","Date","String","String","String","String","String"

GIS-Locations_2.4.csv (first few lines):

"X","Y","accuracy code","postcode","unique-id","name","network","denomination","notes","website","awards","icon-size2","award1","award2","award3","award4","wildlife-biodiversity","solar","date-built","churches trust URL","OS ref" 
"349344.8977","1053019.497","2","KW17 2BU","2203","St. Ann's, Papa Westray","Orkney Islands","C of S","","","4","3","2003-10-09","2006-08-19","2009-07-07","2013-11-01","","x","1841","http://www.scotlandschurchestrust.org.uk/church/st-anns-papa-westray","HY495516" 
"345691","1046915","3","KW17 2DB","2202","Westray Church","Orkney Islands","C of S","","","4","3","2003-10-09","2006-08-19","2009-07-08","2013-11-01","","","1846","http://www.scotlandschurchestrust.org.uk/church/westray-parish-kirk","HY457462" 
"272400.702","655262.3425","2","ML3 7DT","2801","St John's Church Of Scotland, Hamilton","South Lanarkshire","C of S","","http://www.stjohnshamilton.org.uk","3","2.5","2003-05-01","2006-03-05","2009-07-09","","","","1835","http://www.scotlandschurchestrust.org.uk/church/st-johns-church-hamilton","NS724553"

I have confirmed that running GDAL from the command line gives the expected result (using "ogrinfo GIS-Locations_2.4.csv -al").

I initially thought this might be user error, and so put up a post on gis.stackexchange.com (http://gis.stackexchange.com/questions/146291/importing-csv-file-with-csvt-data-in-qgis-2-8-will-not-assign-type-date-to-f) but have concluded (with help) that this is likely a bug in the current build of QGIS. I'm running 2.8.2 (but also had problem in 2.8.1) on MacOS 10.10.3 and have also confirmed that this is an issue in QGIS windows (running inside virtualbox on Win XP).

table_in_spatialite.PNG (15.3 KB) Saber Razmjooei, 2015-05-20 10:08 AM


Related issues

Related to QGIS Application - Bug report #15816: QGIS overrides CSVT "String" format and makes integer ins... Closed 2016-11-04
Related to QGIS Application - Bug report #18789: Import of CSV-Data Closed 2018-04-22

History

#1 Updated by Saber Razmjooei over 9 years ago

Maybe this is the limitation of importing it as csv.
If you import it as a spatialite table and then make geometry, the data type will be preserved (see attached.)

#2 Updated by Saber Razmjooei over 9 years ago

  • Status changed from Open to Feedback

#3 Updated by Jürgen Fischer over 9 years ago

  • Category set to Data Provider/Delimited Text

#4 Updated by Giovanni Manghi almost 9 years ago

  • Affected QGIS version changed from 2.8.2 to master
  • OS version deleted (10.10.3)
  • Operating System deleted (MacOS)
  • Status changed from Feedback to Open

#5 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#6 Updated by Jürgen Fischer over 6 years ago

  • Related to Bug report #15816: QGIS overrides CSVT "String" format and makes integer instead added

#7 Updated by Jürgen Fischer over 6 years ago

#8 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Closed
  • Resolution set to end of life

Also available in: Atom PDF