GIS Blog

Spatial Join Tool

Samuel takes us through using the Spatial Join tool.

Spatial Join Tool – 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 “Geoprocessing – Analysis Tools – Overlay – Spatial Join,” in ArcGIS.

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.

The example here is a polygon layer representing Christchurch neighborhoods, and another one is a point layer for the votes in different locations.

Let’s say our GIS expert Crile is running for mayor. (Ed. one thing Crile would never do is run for mayor.)  The feature points here indicate the votes he gets from each suburb.

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

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.

That result enables us to compare the total points between different polygons, so we know which suburbs contribute the most votes to Crile.

To get started, what we have to do is find the Spatial Join tool.

The quick way is, clicking the Analysis tab lighted at the top, and clicking Spatial Join indicated above.

The second way is using the Geoprocessing search function to find the tool, by clicking the Tools Box under the Analysis tab.

The third way is right-clicking the Neighbourhoods layer to get access into the Spatial Join tool, which will preselect “Neighbourhoods” as the Target Features.

The Target Features is the layer you are going to join data from another layer into to create a third layer.

Therefore, the Target Features, in this case, is the Neighbourhoods, and the Join Features is my Votes layer.

The Output Features Class is where you save and name the third layer, in this case, I name it something meaningful as “CrilesVotesInNeighbourhoods.”

I leave the Join Operation as “join one to one”.

I also want to keep all target features, so I will leave the box ticked.

Therefore, I can keep all polygons in the output layer even they don’t have any votes within particular suburbs.

Next, we go to the Output Fields and remove the attributes we don’t need within our third layer.

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.

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.

For the Merge Rule, I leave it as “First”.

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.

Once you see the “Spatial Join completed” message, you should see a new layer called “CrilesVotesInNeighbourhoods” in your contents on the left side panel.

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.

 

Let’s quickly look at the attribute table!

Okay, now you can see this Join_Count Column, which represents the number of points that have been counted for each polygon or suburb.

And I still retain the names of the suburbs as well.

We can spot-check this by randomly left-clicking one polygon and right-clicking that selection to zoom into that polygon.

Now we can see, that exactly 4 points/votes have been counted for Bush Inn area on the map which matches the number “4” shown on the Attribute Table.

This means 4 persons voted for Crile to be their major.

Now I want to use different colors to show the different numbers of votes on the map. I unticked the Vote layer.

I right-click the CrilesVotesInNeighbourhoods layer and go to the symbology. I change from Single Symbol to Graduated Colors.

Now we can see the different neighborhoods showing in different colors. The color with higher intensity means more votes.

In this map we can see, Crile has more votes from the residents living in the city center area.

 

Thank you everyone for reading my blog!

End.

22 October 2021

Samuel Lin

• 11/11/2021


Previous Post

Next Post

Leave a Reply

Your email address will not be published / Required fields are marked *