{"id":3485,"date":"2021-11-11T09:33:35","date_gmt":"2021-11-10T20:33:35","guid":{"rendered":"http:\/\/blogs.lincoln.ac.nz\/gis\/?p=3485"},"modified":"2021-11-11T09:33:35","modified_gmt":"2021-11-10T20:33:35","slug":"spatial-join-tool","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/spatial-join-tool\/","title":{"rendered":"Spatial Join Tool"},"content":{"rendered":"<p><em>Samuel takes us through using the Spatial Join tool.<\/em><\/p>\n<p><strong>Spatial Join Tool &#8211; Votes for Crile.D running for Christchurch Mayor!<\/strong><\/p>\n<p><strong>Kia ora, everyone.<\/strong><\/p>\n<p>My name is Samuel Lin, today I will through the Spatial Join tool, which lives under \u201cGeoprocessing &#8211; Analysis Tools \u2013 Overlay \u2013 Spatial Join,\u201d in ArcGIS.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3522\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-13.png\" alt=\"\" width=\"505\" height=\"735\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-13.png 505w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-13-206x300.png 206w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%2813%29.png\" alt=\"\" \/><\/p>\n<p>In this scenario, we have a couple of layers in our content, which we want to eventually combine their attributes to get something else as a result.<\/p>\n<p>The example here is a polygon layer representing Christchurch neighborhoods, and another one is a point layer for the votes in different locations.<\/p>\n<p>Let\u2019s say our GIS expert Crile is running for mayor. (<em>Ed. one thing Crile would <span style=\"text-decoration: underline\"><strong>never<\/strong> <\/span>do is run for mayor.<\/em>)\u00a0 The feature points here indicate the votes he gets from each suburb.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3523\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-1-1.png\" alt=\"\" width=\"1251\" height=\"656\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-1-1.png 1251w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-1-1-300x157.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-1-1-1024x537.png 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-1-1-768x403.png 768w\" sizes=\"auto, (max-width: 1251px) 100vw, 1251px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%281%29.png\" alt=\"\" \/><\/p>\n<p>What we want to do here is to create a new feature class or a layer that represents the neighborhoods but also presents how many votes that actually fall within each particular polygon (so we know how many votes Crile gets from each suburb).<\/p>\n<p>The Spatial Join tool works very well for this purpose, which helps us combine two layers together to count the total points in each polygon.<\/p>\n<p>That result enables us to compare the total points between different polygons, so we know which suburbs contribute the most votes to Crile.<\/p>\n<p>To get started, what we have to do is find the Spatial Join tool.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3524\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-2-1.png\" alt=\"\" width=\"1272\" height=\"619\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-2-1.png 1272w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-2-1-300x146.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-2-1-1024x498.png 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-2-1-768x374.png 768w\" sizes=\"auto, (max-width: 1272px) 100vw, 1272px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%282%29.png\" alt=\"\" \/><\/p>\n<p>The quick way is, clicking the Analysis tab lighted at the top, and clicking Spatial Join indicated above.<\/p>\n<p>The second way is using the Geoprocessing search function to find the tool, by clicking the Tools Box under the Analysis tab.<\/p>\n<p>The third way is right-clicking the Neighbourhoods layer to get access into the Spatial Join tool, which will preselect \u201cNeighbourhoods\u201d as the Target Features.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3525\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-3-1.png\" alt=\"\" width=\"1272\" height=\"752\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-3-1.png 1272w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-3-1-300x177.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-3-1-1024x605.png 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-3-1-768x454.png 768w\" sizes=\"auto, (max-width: 1272px) 100vw, 1272px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%283%29.png\" alt=\"\" \/><\/p>\n<p>The Target Features is the layer you are going to join data from another layer into to create a third layer.<\/p>\n<p>Therefore, the Target Features, in this case, is the Neighbourhoods, and the Join Features is my Votes layer.<\/p>\n<p>The Output Features Class is where you save and name the third layer, in this case, I name it something meaningful as \u201cCrilesVotesInNeighbourhoods.\u201d<\/p>\n<p>I leave the Join Operation as \u201cjoin one to one\u201d.<\/p>\n<p>I also want to keep all target features, so I will leave the box ticked.<\/p>\n<p>Therefore, I can keep all polygons in the output layer even they don\u2019t have any votes within particular suburbs.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3521\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-4-1.png\" alt=\"\" width=\"322\" height=\"778\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-4-1.png 322w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-4-1-124x300.png 124w\" sizes=\"auto, (max-width: 322px) 100vw, 322px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%284%29.png\" alt=\"\" \/><\/p>\n<p>Next, we go to the Output Fields and remove the attributes we don\u2019t need within our third layer.<\/p>\n<p>We are doing a spatial join, so we are creating another field within my new feature class that represents a count for how many points fall in each polygon.<\/p>\n<p>The other I want to retain in the new feature class I am creating is the name of the suburbs, so I have something to symbolize my counts.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3526\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-5.png\" alt=\"\" width=\"329\" height=\"776\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-5.png 329w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-5-127x300.png 127w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%285%29.png\" alt=\"\" \/><\/p>\n<p>For the Merge Rule, I leave it as \u201cFirst\u201d.<\/p>\n<p>Basically what it is going to do is that if it is the first time for the point to encounter that the polygon name, then it will be assigned to this polygon first.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3527\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-6-1.png\" alt=\"\" width=\"328\" height=\"772\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-6-1.png 328w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-6-1-127x300.png 127w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%286%29.png\" alt=\"\" \/><\/p>\n<p>Once you see the &#8220;Spatial Join completed&#8221; message, you should see a new layer called \u201cCrilesVotesInNeighbourhoods\u201d in your contents on the left side panel.<\/p>\n<p>I now only leave the Votes and CrilesVotesInNeighbourhoods layers ticked\/turned on. I also move the Votes layer to the top, so we can see the points.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3528\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-7-1.png\" alt=\"\" width=\"339\" height=\"517\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-7-1.png 339w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-7-1-197x300.png 197w\" sizes=\"auto, (max-width: 339px) 100vw, 339px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%287%29.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Let&#8217;s quickly look at the attribute table!<\/p>\n<p>Okay, now you can see this Join_Count Column, which represents the number of points that have been counted for each polygon or suburb.<\/p>\n<p>And I still retain the names of the suburbs as well.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3530\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-8-1.png\" alt=\"\" width=\"844\" height=\"386\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-8-1.png 844w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-8-1-300x137.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-8-1-768x351.png 768w\" sizes=\"auto, (max-width: 844px) 100vw, 844px\" \/><\/p>\n<p>We can spot-check this by randomly left-clicking one polygon and right-clicking that selection to zoom into that polygon.<\/p>\n<p>Now we can see, that exactly 4 points\/votes have been counted for Bush Inn area on the map which matches the number \u201c4\u201d shown on the Attribute Table.<\/p>\n<p>This means 4 persons voted for Crile to be their major.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3529\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-9-1.png\" alt=\"\" width=\"845\" height=\"462\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-9-1.png 845w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-9-1-300x164.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-9-1-768x420.png 768w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%289%29.png\" alt=\"\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3531\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-10.png\" alt=\"\" width=\"739\" height=\"411\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-10.png 739w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-10-300x167.png 300w\" sizes=\"auto, (max-width: 739px) 100vw, 739px\" \/><\/p>\n<p style=\"text-align: left\" align=\"center\"><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%2810%29.png\" alt=\"\" \/>Now I want to use different colors to show the different numbers of votes on the map. I unticked the Vote layer.<\/p>\n<p>I right-click the CrilesVotesInNeighbourhoods layer and go to the symbology. I change from Single Symbol to Graduated Colors.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3532\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-11.png\" alt=\"\" width=\"440\" height=\"745\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-11.png 440w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-11-177x300.png 177w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%2811%29.png\" alt=\"\" \/><\/p>\n<p>Now we can see the different neighborhoods showing in different colors. The color with higher intensity means more votes.<\/p>\n<p>In this map we can see, Crile has more votes from the residents living in the city center area.<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3533\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-12.png\" alt=\"\" width=\"1000\" height=\"652\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-12.png 1000w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-12-300x196.png 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/11\/image-12-768x501.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><img decoding=\"async\" src=\"https:\/\/learn.lincoln.ac.nz\/pluginfile.php\/1\/blog\/post\/68\/image%20%2812%29.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Thank you everyone for reading my blog!<\/p>\n<p>End.<\/p>\n<p>22 October 2021<\/p>\n<p>Samuel Lin    \t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Samuel takes us through using the Spatial Join tool. Spatial Join Tool &#8211; Votes for Crile.D running for Christchurch Mayor! Kia ora, everyone. My name is Samuel Lin, today I will through the Spatial Join tool, which lives under \u201cGeoprocessing &#8211; Analysis Tools \u2013 Overlay \u2013 Spatial Join,\u201d in ArcGIS. In this scenario, we have [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3485","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/3485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/comments?post=3485"}],"version-history":[{"count":0,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/3485\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=3485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=3485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=3485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}