I have created a new field column in the attribute table for my shapefile as shown below.

enter image description here

I now need to add data to these rows from another datafile. Is there a way to do it other than manual editing and adding data to each row? There are about 27000 rows.

  • 2
    Is there an attribute relation like a common ID or a spatial relation like a intersect, touch or nearest feature between the features of the 2 datafiles? You should provide more information on that.
    – eurojam
    Aug 24 at 4:42

A requirement for this solution is that your shapefile and the other data file should have a unique identifier for merging. Meaning that the values of a column in your shapefile should match the values of a column in the second data file.

  1. The relationship could be one-to-one: Each row in the shapefile has a unique value in the index column (column that we need to connect the data to the other file). And the other data should have an exact equivalent value in their rows that is too, unique in the column.

  2. The relationship could be one-to-many: Values in the shapefile index column can be duplicated, but they should be uniquely specified in the other data.

If your datasets are following one of these criteria, then you can proceed. Otherwise, you may construct a many-to-many relationship that would increase the row count dramatically.

First, you need to load the other data. You still can import it even if it is a table without geometries.

After loading the data, right-click on your shapefile layer and choose properties. In the properties panel and then go to the join tab and click on the plus bottom: enter image description here

After that a window will show up where you need to specify the join columns:

enter image description here

Choose the parameters accordingly:

Join layer is your other data file.

Join field is the index column in the data file table.

Target field is the index column name in your shapefile.

There are other options which you can play around, such as selecting few column, add prefix etc.

Hit OK and your data should appear in the attribute table of the shapefile.

Now you can use field calculator to fill your ChangePM25 column.

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.