TransWikia.com

Join attributes by location in QGIS 3

Geographic Information Systems Asked by Senda on April 6, 2021

I wonder if there is a better way to join attributes based on location.

I have a vector layer with polygons representing lines.
Layer A is the layer where I want to take the correct attributes and Layer B is the layer with the merged/dissolved polygons.

They’re split into multi parts and I merged/dissolved them based on ‘type’ attribute (see image tables).

After merging/dissolving the polygons I want to re-assign the attributes back, based on the location.
I’ve tried the tool join attributes by location selecting ‘contains’ and ‘one to one’ join. The result displayed here is correct but with other features it looks like that it’s taking the attributes of the adjacent polygon (which has different type attribute) instead of the
the polygon that falls in the same area and same attribute type.
So I have to check them manually which is a lot of time consuming if you have hundreds of features.

Layer ALayer Battributes

I have also tried using PostGIS, which I’m new, using the following spatial query:

SELECT table_A
FROM
table_A,
table_B
WHERE
st_contains(table_B.geom, table_A.geom);

Using this I get only a few features joined. What am I missing here?

Is there any other way to do this without spending too much time checking the features manually? Using python inside or outside QGIS or Arcmap?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP