Note: spatial selection only works with database layers, not with files. If you want perform spatial queries please import files you need into the database first. Also, make sure that multigeometry type is exploded into the geometry.

Spatial selection allows you to create database queries for layers that reside in the database. This tool allows you to select any database feature from any database layer in your Map View.

You can select features by attributes or by location depending on what do you need.

Basic spatial selection is performed in the following way (use the pictures above and below for reference):

  1. Click the Feature tab.
  2. Select Spatial Selection.

NMT_Spatial_Selection2

 

Example 1. Select polygons that have the ID attribute less then 1800:

  1. Select table from the dropdown list.
  2.  
    spatial3
     

  3. Select column from the dropdown list.
  4.  
    spatial5
     

  5. Write condition “i.e. <1800”.
  6. Click Select.

Create new layer from selecion

 
NMT_Spatial_Selection3
 

  1. Click New Layer from Selection.
  2. Click Clear selection.

Example 2. Select lines within the polygons:

  1. Click ST_Within() or write it into the Condition bar.
  2.  
    spatial21
     

  3. Select line layer and geometry column (wkb_geometry).
  4.  
    spatial22
     

  5. Click “+” button to add another table.
  6.  
    spatial23
     

  7. Select polygon layer and geometry column (wkb_geometry).
  8.  
    spatial24
     

  9. Click Select button.
  10.  
    NMT_Spatial_Selection4
     

  11. Click New layer from Selection.
  12. Click Clear selection.

Click here to see more examples.