QGIS3 - Join by location (falsely) adds neighbouring polygons












3















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










share|improve this question





























    3















    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










    share|improve this question



























      3












      3








      3








      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










      share|improve this question
















      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







      qgis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 11 at 17:00







      tilkas

















      asked Jan 11 at 13:35









      tilkastilkas

      184




      184






















          2 Answers
          2






          active

          oldest

          votes


















          4














          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.






          share|improve this answer



















          • 3





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

            – Ian Turton
            Jan 11 at 14:25



















          2














          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.






          share|improve this answer
























          • 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..

            – tilkas
            Jan 11 at 16:55






          • 1





            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.

            – MrXsquared
            Jan 11 at 17:07











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f308343%2fqgis3-join-by-location-falsely-adds-neighbouring-polygons%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          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.






          share|improve this answer



















          • 3





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

            – Ian Turton
            Jan 11 at 14:25
















          4














          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.






          share|improve this answer



















          • 3





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

            – Ian Turton
            Jan 11 at 14:25














          4












          4








          4







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 11 at 13:53









          Mohannad AdhamMohannad Adham

          37916




          37916








          • 3





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

            – Ian Turton
            Jan 11 at 14:25














          • 3





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

            – Ian Turton
            Jan 11 at 14:25








          3




          3





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

          – Ian Turton
          Jan 11 at 14:25





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

          – Ian Turton
          Jan 11 at 14:25













          2














          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.






          share|improve this answer
























          • 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..

            – tilkas
            Jan 11 at 16:55






          • 1





            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.

            – MrXsquared
            Jan 11 at 17:07
















          2














          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.






          share|improve this answer
























          • 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..

            – tilkas
            Jan 11 at 16:55






          • 1





            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.

            – MrXsquared
            Jan 11 at 17:07














          2












          2








          2







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 11 at 14:43









          MrXsquaredMrXsquared

          1,1731316




          1,1731316













          • 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..

            – tilkas
            Jan 11 at 16:55






          • 1





            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.

            – MrXsquared
            Jan 11 at 17:07



















          • 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..

            – tilkas
            Jan 11 at 16:55






          • 1





            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.

            – MrXsquared
            Jan 11 at 17:07

















          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..

          – tilkas
          Jan 11 at 16:55





          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..

          – tilkas
          Jan 11 at 16:55




          1




          1





          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.

          – MrXsquared
          Jan 11 at 17:07





          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.

          – MrXsquared
          Jan 11 at 17:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f308343%2fqgis3-join-by-location-falsely-adds-neighbouring-polygons%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Human spaceflight

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          張江高科駅