Maybe your point data is missing some data - your cities need states, or your businesses need ZIP codes. Luckily, you have a shapefile of those states or those zip codes. You can use a spatial join to add the columns from a shape to the points hiding inside.
In my example, I’m going to give the schools neighborhoods.
First, semi-obviously, you’ll need to open up your data in QGIS.
Make sure they have the same CRS (what’s that?) - if not, change the CRS to match.
I’ve used a shapefile of schools in NYC and a shapefile of neighborhoods.
Make sure that your features overlap! If you don’t see any points in the same area as your shape, something probably went wrong with your CRS.
Right-click your layer, then select Open Attribute Table. This will allow you to browse all of the columns in your data. I’m going to use it to double-check that I have a neighborhood name column in neighborhood boundaries shapefile.
We’re in luck! I see that NTAName
is what I’m going to be looking for.
Now use the top menu, and select Processing > Toolbox
.
A new interface should appear to the right-hand side of your screen.
Add polygon attributes to points
Filter the long long toolbox list by typing “add” into the top, then select Add polygon attributes to points.
Select your points layer, your polygons layer, as well as the attribute you’d like to copy over. I’m using NTAName
.
If you didn’t select a place to save your file, you’ll have a new layer called Result
. Right-click and open attribute table to examine what’s inside.
Success! Now we have all of our schools associated with a neighborhood, perfect for creating tooltips in an interactive map.
Right-click your Result
layer, and select Save As...
. You’ll probably want to save the layer as WGS 84
- if you need to learn more about what a CRS is, do that here.
Maybe you’d like to learn how to color your map based on a column, or export as geojson or as CSV?