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









New contributor




tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    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









    New contributor




    tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      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









      New contributor




      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      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









      New contributor




      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 12 hours ago







      tilkas













      New contributor




      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 16 hours ago









      tilkastilkas

      184




      184




      New contributor




      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      tilkas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          3














          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



















          • 2





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

            – Ian Turton
            15 hours ago



















          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
            12 hours ago






          • 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
            12 hours ago











          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
          });


          }
          });






          tilkas is a new contributor. Be nice, and check out our Code of Conduct.










          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









          3














          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



















          • 2





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

            – Ian Turton
            15 hours ago
















          3














          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



















          • 2





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

            – Ian Turton
            15 hours ago














          3












          3








          3







          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 15 hours ago









          Mohannad AdhamMohannad Adham

          34415




          34415








          • 2





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

            – Ian Turton
            15 hours ago














          • 2





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

            – Ian Turton
            15 hours ago








          2




          2





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

          – Ian Turton
          15 hours ago





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

          – Ian Turton
          15 hours ago













          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
            12 hours ago






          • 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
            12 hours ago
















          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
            12 hours ago






          • 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
            12 hours ago














          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 14 hours ago









          MrXsquaredMrXsquared

          992216




          992216













          • 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
            12 hours ago






          • 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
            12 hours ago



















          • 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
            12 hours ago






          • 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
            12 hours ago

















          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
          12 hours ago





          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
          12 hours ago




          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
          12 hours ago





          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
          12 hours ago










          tilkas is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          tilkas is a new contributor. Be nice, and check out our Code of Conduct.













          tilkas is a new contributor. Be nice, and check out our Code of Conduct.












          tilkas is a new contributor. Be nice, and check out our Code of Conduct.
















          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

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?