GIS Tips – Spatial Join data IN QGIS!

Just found this on the Harvard website (Harvard University QGIS Workshop) and it is something I have always done in ArcGIS, never thinking that it was even possible in QGIS, afterall why would I when ArcGIS has a big shiny “Spatial Join” button. So I was pretty surprised to read this, and then ticked another box off the list of QGIS v ArcGIS…I tell you now, the list is running pretty equal at present, the only thing missing is a 3D element to QGIS…..

Source: Harvard University QGIS Workshop 26/07/2013

A common GIS task is to join the attributes from one spatial data layer to another. In this example we will join the attribute table from a polygon layer to a points layer, based on which polygon contains the points.

Prepare Target Points Layer
  • For this exercise, we’ll use a set of points generated in Google Maps, showing some interesting sites in Taiwan
  • Add Vector Data, set UTF-8 encoding, and browse to china/taiwan_points.kml
  • Save As filename “TW_pts_big5” as format = ESRI Shapefile and encoding = BIG5 (we want to join BIG5 attribute table to this target layer, so SET CORRECT ENCODING FOR THE DATA THAT WILL BE JOINED)
  • Add the newly created TW_pts_big5 layer and remove the imported taiwan_points KML import layer.
  • Target Points layer should be ready for the join
Prepare Join Layer
  • Now we want to Add Vector Layer and browse to the TW_POP layer, encoding = big5
  • Open the Attribute Table to make sure the encoding looks okay. If it looks fine, close the attribute table.

Run the Join
  • Set the TARGET LAYER = TW_points_big5, set the JOIN LAYER = TW_POP
  • Click on the OUTPUT SHAPEFILE BROWSE button to set output path, filename, and encoding = big5, then click SAVE
  • Click OK and you will be prompted to add the new join shapefile to the TOC (table of contents), click YES
  • Open the Attribute Table of the new join layer. Each point feature now includes the attributes from the JOIN layer, having done a SPATIAL JOIN on the polygon that the point was located in.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.