8 Viewing a Query to QGIS

You don’t have to save a query as a table to view it in QGIS. Sometimes you just want to see the results, but don’t need to keep a table that you might not need later. Let’s see the spatial join we just did in the QGIS map canvas:

  1. After you run the code to do the spatial join above, you will see a check box below the table that says Load as new layer. Click in the box to check it off. New options will appear.
  2. Check the box next to Column with unique values and select id from the list.
  3. Check the box next to Geometry column and select geom from the list.
  4. Fill in the Layer name (prefix) with “Flowlines in Watersheds”.
  5. Click the Load button. It may take it a few minutes to load because the flowlines layer is large.

Now you have access to the Layer Properties and all the other tools you might use with any other vector layer in QGIS. For fun, let’s style this layer:

  1. Open up the Layer Properties (right click on the layer in the Layers Panel and select Properties).
  2. Click on the Symbology tab.
  3. Instead of Single Symbol, let’s pick Categorized from the top drop-down menu.
  4. For the Column, pick Watershed_Name
  5. Click the Classify button near the bottom.
  6. Finally, click OK to close the dialog and apply our changes.