By tilkas


2019-01-11 13:35:27 8 Comments

I have two layers:
Layer 1 - containing municipalities of country X in the year 2014 (around 600)
Layer 2 - containing municipalities of country X in the year 2018 (around 500)

Between 2014-2018 several municipalities have merged. E.g. municipality A, B and C in the 2014 layer no longer exist in 2018 but are now part of municipality D.

I want to know for each 2014 municipality what its corresponding 2018 municipality is. So for municipality A, B and C the outcome should be D.

enter image description here

enter image description here

I tried to achieve this by performing Join by Location (using intersect). I would expect the joined layer to have 600 features (i.e. the number of 2014 municipalities) with a new attribute containing the corresponding 2018 municipality. However, the joined layer I get has over 2400 features. Municipality A is present 4 times, one entry has municipality D as new attribute (as expected) but the other 3 entries have the neighbouring municipalities of A as new attribute (E, F and I). I.e. QGIS seems to think that municipality A does not only intersect with D but also with all neighbouring municipalities of A.

Am I doing something wrong here?

Both layers have the same CRS.

Edit: Found out that if I zoom in a lot (ratio 85:1) there's a small difference between the two layers. I guess this causes the issue.

enter image description here

2 comments

@MrXsquared 2019-01-11 14:43:59

Set it up the following:

  • As input layer choose your old municipalities (2014).
  • As join layer choose your new municiplaities (2018).
  • As geometric predicate choose overlaps, within and equals.

enter image description here

The result:

enter image description here

Of course this will only work if the actual boundaries did not move.

@tilkas 2019-01-11 16:55:53

Thanks! I tried this but unfortunately still get 2500+ features. When I zoom in a ridiculous amount (85:1!) I can see that there's a small difference between the borders of the two layers. I guess that's the cause of this issue..

@MrXsquared 2019-01-11 17:07:22

yes, this only works when the border lines stay the same and just the area allocation changed. In your case you will then probably get a better result with centroids (or pointonsurface) as @MohannadAdham suggested.

@Mohannad Adham 2019-01-11 13:53:14

The solution is to do the following:

  • Generate the centroids of the polygons of 2014
  • Spatially join the centroids with the polygons of 2018
  • Join by attribute the polygons of 2014 with their centroids

I hope this would help.

@Ian Turton 2019-01-11 14:25:46

To add to this Intersection includes where the boundaries of a pair of polygons overlap (what you think of as touching).

Related Questions

Sponsored Content

2 Answered Questions

2 Answered Questions

[SOLVED] Show municipality in different colour than commune

  • 2018-08-24 11:47:53
  • Monika B.
  • 85 View
  • 2 Score
  • 2 Answer
  • Tags:   qgis atlas

1 Answered Questions

[SOLVED] Permanent attribute join (for dissolving)

1 Answered Questions

[SOLVED] Spatial join string attributes for intersecting polygons (QGIS)

  • 2017-08-30 17:37:49
  • bpdronkers
  • 318 View
  • 2 Score
  • 1 Answer
  • Tags:   qgis spatial-join

0 Answered Questions

Outputting to multiple attribute fields after Spatial join?

  • 2017-06-16 19:02:48
  • user99279
  • 31 View
  • 1 Score
  • 0 Answer
  • Tags:   qgis spatial-join

0 Answered Questions

Selecting nearby polygons in QGIS?

1 Answered Questions

[SOLVED] Why does QGIS only intersect one part of the layer?

1 Answered Questions

[SOLVED] Reproject before a Spatial Join

0 Answered Questions

How do I join multiple features with a single geometry-less table entry?

Sponsored Content