1

Currently, I have two attribute tables my vector table and an additional table for vector interaction. I was wondering if I could merge the attribute tables within the software. As I would like to use the 'delete duplicate geometries' as some of the data would be reoccurring and would like to delete them without manually doing that. Is this possible?

  • 1
    Yes. Take a look at 'join' function. You need a matching field in both tables. – MrXsquared Jun 9 at 18:35
2

You can merge them by going to:

Vector > Data management tools > Merge vector layers

you can also join two attribute tables in Layer Properties but as mentioned above you'll need a common field between attribute tables.

 properties > join

To eliminate duplicate geometries you can both dissolve the layer by field:

Vector > Geoprocessing tools > Dissolve

or search for Delete duplicate geometries in the Processing toolbox

1

Tested on QGIS 2.18 and QGIS 3.4

Alternatively, I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have six features in 'LayerA' (there are two features with the same geometry, namely "Name 5") and a csv-file ('data') with some values that we are interested in, see image below. Instead of a csv-file can be a usual shapefile as well.

input

With the following query, it is possible to join "values" from a csv-file.

SELECT DISTINCT a.*, d."value"
FROM "LayerA" AS a
JOIN "data" AS d ON a."Name" = d."Name"

The SELECT DISTINCT statement is used to return only distinct (different) values.

The output Virtual Layer with its Attribute table including new values will look as following

output


References:

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.