Spatial selections in QGIS

“Spatial selections allow you to select the features of one layer using the geometries of another layer..”

Sometimes you want to use one layer to select features from another. For example, you could select roads that intersect with a flooded layer to find out which roads might be flooded. QGIS provides tools to do this kind of analysis which we will look at in more detail here.

You try:

Goal: To review the Natural Earth Airports dataset and see if there is an airport in every country of the world.

  • Load the Countries and airports layers from Natural Earth (see specification table below).
  • Set your project projection to World Mollweide (EPSG:54009)
  • Use the Vector -> Research Tools -> Select by location tool to select all countries that contain an airport.
  • Invert the feature selection
  • Save the selected features to a new layer using the Layer -> Save as menu
  • Make a composer layout
  • Add a table to the layout with the properties as listed in the table below
  • Generate a nice report of countries without airports as a PDF - if you are able to, add a little pizazz to your report like the example above.

Name Expectation

Countries layer

ne_10m_admin_0_countries in the ne.sqlite database

Airports layer

ne_10m_airports in the ne.sqlite database

Composer table settings

Attributes - remove all columns except 'admin' Attributes - column header set to 'Country' Show grid - disable Fonts and text styling - Alignment set to centre - Font set to bold

More about

Does your report look something like the screen-shot above? Bear in mind that the report may simply be a product of an incomplete dataset, so the results in the above example may not reflect the real world situation.

More about the select by location

  • You can use the select by location tool to quickly create a subset of data for a particular region or area.
  • A number of spatial predicates (within, contains, touches etc.) are available which provide fine-grained control over exactly which features will get selected.
  • Depending on the complexity of the geometries being used in the analysis, spatial selection can be a time-consuming operation.
  • There are many other spatial analysis operations you can perform - explore the vector menu in QGIS.
  • All of the analysis tools in the QGIS vector menu can be chained in complex work flows by using the Processing Toolbox.

Check your knowledge:

  1. The select by location will find all features near to a specific location:

    1. True
    2. False
  2. Indicate which statements are correct:

    1. The select by location tool is also available in the processing toolbox.
    2. Spatial selection is one of the fastest operations you can do in GIS
    3. Spatial selection is one of the fastest operations you can do in GIS
    4. The select by location tool will always create a new dataset