3

I have data in an Excel file that I want to join with a shapefile in my project. The Excel file contains values like volumes. The Excel file and the shapefile I want to join it with both contain the same property names.

The problem is, when I join the two, I get too many decimals in the attribute table. I get six, but I only want it to be one.

I tested to change the format of the cells to one decimal, and then I saved the file as *csv. But, somehow I seem to loose data in the process? It should be 42 rows that contains data in the column i am working with, but I end up with only like 10?

Another thing is that my property names contains the letters Å. Ä and Ö, perhaps this complicates things?

I read the question How can I change the precision in the attribute table?, but it doesn't mention the problem with the data loss.

My question was tagged with , but I didn't write what version I'm using. I use QGIS 2.2.0. Would it help to upgrade to the latest version?

  • I just wanted to say thanks for this thread, the QGIS walkthrough is fantastic and very helpful. – Lorin Crandall Apr 17 '18 at 19:51
5

Notice that in this cases you can create a new column with the desired size and precision, and populate it's values with the "old" column values. After saving, your new column will have the wanted precision.

Take this exemple. I have a table with a column ("test") with a precision size 20 and precision 15.

enter image description here

I will open the field calculator (the abacus symbol), to create a new column with the right precision, and give it same values as the older column.

enter image description here

Checking my attribute table, I now have both columns with different precisions:

enter image description here

From this point you could simply delete the older column. But you probably want your new column to have the original name (and maybe column position)? For that, you can use the table manager plugin. If not installed you can get it in Plugins > Manage and Install Plugins. And it will be available at Vector > Table manager.

enter image description here

You should, select and delete the old column, and then select and rename the new column. (And move it up to the old column relative position?)

Notice you can take care of your Å, Ä and Ö characters with table manager as well.

  • Excellent! The new column and the table manager did the trick. – SoS Aug 11 '14 at 11:19
1

After writing this I just realized that you were talking about QGIS and not ArcMap but I will keep it here anyway.

After doing your join with the unaltered csv table right click the field title in the attribute table and select "Properties". In the Field properties dialog you select the button labeled "Number Format: Numeric" as seen below.

Field Properties Dialog

After you select that button the Number Format Dialog will show and look like the image below.

Number Format Dialog

This dialog works like in input mask and preserves your data but you will only see whatever format you want. in your case I would set the rounding option from the default 6 to 1. Hope this is the answer you wanted. Also, I would avoid using non ASCII characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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