Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have county data in which the FIPs (actually State FIPS and County FIPS combined). I have data imported as CSV with the sames FIPS data titled STCounty. However, the shapefile FIPS is listed as a Real and the CSV came in as an Integer and the Join function does not seem to work. The drop boxes are greyed out/empty.

So the bigger questions is how do you change the attribute type in a table? I tried to create a new column in the shapefile (county data) and set it to an integer and then multiply the FIPS*1, but got a column full of "NULL".

I am new to QGIS and have a lot of experience in MapInfo, so the join concept is not new to me, just the syntax in QGIS.

share|improve this question

2 Answers 2

Creating a new integer column is the right way to go - but the 1*FIPS that you used (which would work in Excel or Libreoffice) is where the problem comes in; QGIS doesn't automatically convert between field types in a calculation.

You need to use one of the conversion functions (toint converts to integer, tostring to text, and toreal to real/decimal) with the correct column name:

toreal("FIPS")

You can use the Tablemanager plugin to then remove unnecessary columns.

Setting up a .csvt file would be the best repeatable solution but for a single column, this should be pretty straightforward.

share|improve this answer
    
The 1*FIPS also works in ArcGIS. –  L_Holcombe Nov 5 '12 at 20:28
    
seems kind of silly not to be able to just change the datatype. However, this does seem to be the correct answer –  chrismarx Mar 28 at 19:15

I once answered this question;If you import your Data from a csv file you need to create a csvt file in order to determine the attribut type of a field. See the explanation here: How to change an attribute value from text to number?

Jo

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.