1

If multiple people populate different attributes of the same shapefile on separate computers, is there a way to merge the attribute table without creating copies of the polygons or fields?

Each file will have the same polygons and fields but everyone will be contributing to populating the fields for only some of the polygons. We want to be able to combine all of the files at the end to create one shapefile with all of the populated attributes.

In testing the basic merge functions on QGIS, I found that merging created copies of the fields rather than combining them.

asked May 25, 2022 at 17:37

2 Answers 2

0

one way to do this is to concatenate fields together in the QGIS Field Calculator, using the following equation:

"field1" || "field2"

or to put a space between your fields:

"field1" || ' ' || "field2"

Check out this previous answer here: Concatenating fields in field calculator of QGIS?

answered May 25, 2022 at 18:11
0

Be sure to only have the identical layers loaded in the QGIS project as this soultion is based on automatically looping through all layers in the project, using @layers variable (this returns a list of all map layers in the current project).

You just have to change the attribute name in line 7, then run the expression:

array_filter ( 
 array_distinct( 
 array_foreach(
 @layers,
 attribute(
 get_feature_by_id (layer_property (@element,'name'),$id),
 'value1' -- change the name of the attribute field
 )
 )
 ),
 @element<>''
)[0]

See here how the expression works: enter image description here


Variant

This works if indeed you have unique values per field and feature. If, however, different contributors have entered differing values (like for value1 in polygon1, someone entered one, someone else two), you might want to keep both values: 'one,two'.

To do so, delete [0] at the end of the expression and enclose the whole rest of the expression inside the brakcets of array_to_string(), like this: array_to_string ( <expression_without[0]> )

answered May 19, 2023 at 21:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.