I read in a CSV file for linking to a .shp file.
All the variables that are just numbers came in as text.
How do I change the text variables to numeric in QGIS?
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
I once had the same question. The answer is that you put a file in the same folder with the ending csvt. For example your file name is xyzdata.csv you add the file xyzdata.csvt
This one you can edit with editor for example. And in it you set the data type like this. "Integer","String","Integer","Integer","String","Real"
Integer is now the variable for the first column, string for the second and so on... Make sure the files are named identically.
Edit: See here too if needed: http://underdark.wordpress.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/
Instead of loading the .csv using Add vector layer, use the Delimited Text layer tool. It will try to detect the most fitting data type for each column.
For more details see the QGIS user guide.
Another alternative in case of large datasets to be managed and obviously time consuming to to proceed with the field calculator (without looping) or within a text editor : - save your data as CSV + XY + variable for the joint with our polugone shapefile - upload your CSV with the plug in (import csv) then save as shapefile (point) - then close q gis - back to the folder with the shapefile point, duplicate the corresponding dbf table / rename - open Qgis - upload the new dbf and join to shapefile (polygone features)
One stone, two pigeons : you have potentally 1) a shapefile point with all the data and all the possibility of represention 2) and independant shapefile with dbf table joined (editable !) linked to polygone for thematic cartography
This is a bit rude , but quite straightforward ...