Geographic Information Systems Asked by user10525 on June 14, 2021
I have county data in which the "FIP"
s (actually State "FIP"
s and County "FIP"
s combined). I have data imported as CSV with the sames "FIP"
s data titled ‘STCounty’. However, the shapefile "FIP"
s 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 "FIP"
s*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.
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: Changing CSV layer attribute value from text to number in QGIS?
Answered by Shepherdjo on June 14, 2021
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.
Answered by Simbamangu on June 14, 2021
I just had the same problem. In my case i work with Libreoffice and QGIS.
I exported a table from R to .CSV with two columns: "id" and "veh". "id" is Integer and "veh" Real.
write.csv(tab2,file='/path/table.csv',row.names = F)
When i open the table.csv in Libreoffice the field veh was read it as "string". So i created another coulmn "vehh" as the multiplication of "veh"*1, and the result was the desired number . Then i saved the file as .ODS (Libre Office)
Then i load the table.ODS in qgis and "vehh" was recognized as Real.
Answered by Sergio on June 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP