TransWikia.com

Getting all of combinations of features found on two layers using QGIS

Geographic Information Systems Asked by James McL. on July 24, 2021

This is a problem that seems like it should be simple, but it’s a little difficult to explain. I have two polygon layers, each with a few hundred features (specifically the districts of England and the constituencies of England). What I want is to produce a third polygon layer, which would take in all of the combinations of districts and constituencies.

See the example below for a much simpler version, the first layer has features 1 and 2, the second layer has features 3 and 4. In this case you would want to get four features out -the intersection of 1 from the first layer and 3 from the second, 1 from the first and 4 from the second, 2 from the first and 3 from the second, 2 from the first and 4 from the second.

Is this possible, and is there a more elegant way of phrasing this that I’m not seeing?

Illustration of the problem - I want a third layer with the features being the combinations of all the features in the first two.

One Answer

You can use Intersection tool in "Processing Toolbox Ctrl+Alt+T > Vector overlay" for this.

For example, I have two layers as below:

enter image description here

After using Intersection tool, you get a new layer:

enter image description here

And using "Field Calculator" you can make a new field. Expression: id1 + ',' + id2

enter image description here

Result:

enter image description here

Correct answer by Kadir Şahbaz on July 24, 2021

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