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.

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?

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]> )

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.