I have a two polyline layers - one with 2800 rows, the other with 150 rows. Each row has a unique id column. I need to replace the records in one column of the the 2800-row layer with the records of the same column in the 150-row layer by id. What would be the fastest method to do this?

  • The simplest solution would be to join the two layers and then delete columns see gis.stackexchange.com/q/53351/36886
    – raphael
    Feb 7 '16 at 15:26
  • Two clarifying questions: 1) are the geometries the same for each unique ID? 2) are you only trying to replace data in one column?
    – raphael
    Feb 7 '16 at 15:29
  • it not just a join, I need to substitute the matching records in the 2800-row layer with the 150-row layer. There are 150 matching records Feb 7 '16 at 19:00
  • yes only in one column, and only the matching records Feb 7 '16 at 19:00

If you join by id, as mentioned by @raphael, you could use the following expression in the Field Calculator which would replace values from the old column with those in the joined column. And if there's a NULL in the joined column, the old column will keep its original value:

if( "JoinColumn" IS NULL, "Column", "JoinColumn" )

Field Calculator



If you join the two layers by your unique ID, you will be left with one layer with 150 records and 2x the columns. In the attribute table just delete the extraneous columns and your old column. Then rename the new column to the old column name and save this layer over your old one and you should be golden.

  • But that doesn't solve the problem of substitution, at the moment there are 150 incorrect records in the 2800-row layer that I need to update - I need to update them with the records in the same column from the 150-row layer Feb 7 '16 at 20:02
  • Care to elaborate?
    – raphael
    Feb 7 '16 at 20:03
  • The layers are identical in structure - the number and name of columns are the same Feb 7 '16 at 20:05
  • I could join by id, but then I would have two columns side by side - one with old records - and one with 150 new records and the rest null values - but how to go further than that I am not sure Feb 7 '16 at 20:06

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.