1

I made a union of two adjacent shp (points) files with the same theme (Geochemistry) so the resulting attribute table gave duplicated fields, for example: ID, As_ppm, Ag_ppm, Pb_ppm, ... , ID_2, As_ppm_2, Ag_ppm_2, Pb_ppm_2,... And the elements of the first shp give 'NULL' in the fields of the second shp and vice-versa, As in the screenshot. enter image description here So my goal is to show the combined points for a speciffic element, say Arsenic, so I have tried, without success, expressions like As_ppm || As_ppm_2 , As_ppm + As_ppm_2, combine(As_ppm ,As_ppm_2).

3

Union (geoprocessing) feature make a "union" of 2 dataset (C = A united to B). Probably you are tring to JOIN two dataset.

Try this:

  1. Go to JOIN settings: (right click -> properties -> Join)
  2. Add Vector Join of the second layer (click on "+" green-plus icon) and set these parameters:
    • Join Layer: "the second layer to join"
    • Join field: "ID"
    • Join Target: "ID"

We assume that "ID" is and unambiguous identifier for both the layer's elements.

2

If the two source layers have the same fields, you could combine them together using the merge tool.

Using the data you currently have, you would have to rely on the coalesce function to handle the nulls. If the field has a value, it is used. If the field is NULL, then the replacement value is used. For instance, you could replace null by 0:

coalesce(As_ppm,0) + coalesce(As_ppm_2,0)

1

There is also the NNJoin plugin, which does a nearest-neighbor join. Each point in the first layer will have the attributes added to it from the nearest point in the second layer. Similar to gianfranco di pietro's answer, but without needing a shared, unique identifier.

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.