I am working with QGIS on a Mac, and understand the process for importing a CSV file. However, I do not know how to create the CSVT file to define the CSV file's data types.
Can someone instruct me on how to do this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You have to find a programme, where you can write the extention by hand. For windows you can do it in Gedit. First you type the line "Integer","real",... and so on, as it is written in previous answer and after clicking 'save as' you delete the given extention and type 'csvt' for example programme gives 'fields.txt' then you delete 'txt' and write csvt instead to get 'fields.csvt'. Then you click save. It worked for me. Good luck!
You can either create the file in Excel (or similar) or a basic text editor using the correct format as noted above. Unfortunately Macs have a habit of adding .CSV or .TXT (depending on the software you use to create the file) after the .CSVT that you specified. In finder, right-click and select "
get info" or use "
Command I". in the window that pops up check the
Name & Extension section. You may need to delete the .CSV or .TXT your application added after the .CSVT or simply change the extension to .CSVT. For example, I may have exported the CSVT file I created out of excel and specified the name as test.csvt but it was actually exported as test.csvt.csv (depending on your set-up the .csv at the end may be hidden). In
Finder select the file, use
Command I and under the
Name & Extension remove the final .CSV to end up with test.csv
Hope this helps.