[GIS] Keep the same field headers after joining a table to a shapefile in QGIS

attribute-joinsqgisshapefiletable

I noticed that after joining a table to a shapefile the headers of each fields in the table used for the join are changed by QGIS and they are attributed to a different name.

For instance, I had a shapefile with vegetation_codes and a table with vegetation_codes and veg_definition (these were the headers). After joining the table to the shapefile and also saving the shapefile and creating a new one, the vegetation_classes header was changed into vegetati_1.

Is there a way to keep the original headers?

I am using QGIS Dufour on Windows 7 and the table that I join to the shapefile is CSV (tried with dbf as well and the problem is the same).

Best Answer

No, you cannot keep the original names. The problem is that DBF files and therefore Shapefile attribute tables have a limit of 10 characters for the column names.

When you join two layers, QGIS constructs new attribute names by combining layer and attribute names of the joined layer. To ensure unique column names, QGIS further adds a running number to the end of the name.

You'll have to rename the columns in the resulting file manually. The Table Manager plugin allows easy renaming.

Related Question