I have a dataset (in CSV) and am trying to add several fields with date information, so I can filter points based on this data and generate maps (in QGIS 2.8) which will form a chronological series. To accomplish this, I've done the following:
- I've taken my original CSV and added four fields (see below for final CSV file, date data is in columns 12-15, titled award1-4).
- Data was originally in YYYY-DD-MM format, so I've used the handy command-line csvfix tool to set all the data to be ISO format (YYYY-MM-DD).
- To accompany the CSV file, I've generated a CSVT file, with the same name and path to accompany my CSV, following the instructions in the regularly linked blog post by Anita Graser and the related GDAL docs so my CSVT uses only the following types, "String","Integer","Real","Date" (the fourth of these is the crucial one)
- I have also followed the helpful suggestion in this thread by Underdark / Kristen to use textwrangler to make sure characters are standard, and removing a second line and converting smart quotes resolved an issue in QGIS with importing.
After following these steps my CSV imports just fine in QGIS using 'Add Delimited Text Layer', but the layer only has Real (as "Double"), Int and String (as "Text"), with the date fields rendered as "String" as well. I'd like to have this CSV file import into QGIS with those date fields as "date" data type in QGIS so I can run queries on them. I'd also like to stick with CSV as the format as this data will be placed in an open repository eventually and I'd like other users to be able to view the data without QGIS, but also be able to import relatively painlessly into their own projects.
Has another user accomplished this in QGIS, and more to the point, what step am I missing here to make these fields import properly as "Date" field data type.
Samples of data are as follows:
ECS-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"
ECS-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"