QGIS uses the geographical elements within your layers to enable you to make more sense of your data. This principle is based on the fact that two vector layers can have some sort of relationship between their respective geometries: some points are within a polygon, a polygon has some lines crossing or two polygons overlap partially or totally.
Several functions such as buffers and SQL selections allow you to use the geographic elements of your layers in your analysis.
The SQL selection function within QGIS can be used to extract data from a layer which corresponds to certain criteria.
Intersects: this geographic function compares data within two tables.
A point, line or polygon intersects another point, line or polygon when they have at least a node in common: a network crosses another network for example a road or a railway line.
The intersection means a geographical geometry touches or goes through another.
Contains and its reciprocal Within means geographical geometries are within another geometry.
A geometry A contains a geometry B when it contains the centroid of B.
When B is within A: for example a catchment area contains clients represented by point geometries.
Entirely within and its reciprocal Contains entire.
A geometry A is entirely within a geometry B when the group of nodes of A are within B.
According to the type of the compared geometry, according to needs, depends on which of these operators are chosen.
Generally, use the Intersects function to compare polygons or from polygons to lines.
Spatial analysis example
After having created some areas of interest, let’s analyse the impact of these areas. As a starting point look at those areas which intersect with the buffers PA1 to PA7.
To access the virtual layers function open the DB Manager from the top menu.
The dialogue box in the Info section states that Project layers: Not connected.
In the Providers section double click on the Project layers option.
The various layers are now displayed
Click on the Ilots_Saumur option and view the Info, Table and Preview tabs
Then choose Buffer_Stop_Points.geometry and add a closing bracket
Click in the Group by section and choose Buffer_Stop_Points.ID_PA from the Columns drop down list as in the following screen shot
Click on the Execute button or Ctrl + R
The Co-ordinate Reference System dialogue box appears. Click OK to accept the default co-ordinate system
The layer is loaded into QGIS