Bug report #12783
Import CSV via "add delimited text layer" ignores Date fields in CSVT
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).
Related issues
History
#1
Updated by Saber Razmjooei about 9 years ago
- File table_in_spatialite.PNG added
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 about 9 years ago
- Status changed from Open to Feedback
#3
Updated by Jürgen Fischer about 9 years ago
- Category set to Data Provider/Delimited Text
#4
Updated by Giovanni Manghi over 8 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
- Related to Bug report #18789: Import of CSV-Data added
#8
Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Closed
- Resolution set to end of life
End of life notice: QGIS 2.18 LTR
Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/