We will now solve a task.
We need to find all cadastre in our city, which contain house, but doesn't have a septic tank.
To solve this task we will use a plugin named "Spatial Query Plugin".
First you have to check if this plugin has been installed and enabled.
Go to "Plugins" in the top menu and choose "Manage and Install Plugins...".
In the left panel choose "Installed".
Check that "Spatial Query Plugin" is in the list, and that "x" is marked in the box in front of the text "Spatial Query Plugin".
Click on "Close".
Then we need to add the layers, which we will use to solve our task.
Click on the icon "Add PostGIS Layers".
Pick the connection you want to use. In our example it is named "fds_broyt".
Click on "Connect".
Now we can see all the layers that we have access to.
We will use "kloakk lutir" to find septic tanks.
We will use "husanummur" to find out which cadastre has houses.
And we will of course also use cadastre. This layer is named "m55_oki".
Mark these 3 layers and click on "Add".
We now see that the 3 layers are added.
We are zooming in so we can see what we work with.
In the left panel we can see that the layer "kloakk_lutir" contains many different types. We only need "Rottangi" for our task, so we will filter the rest out.
Right click on the layer "Kloakk lutir".
At the top on the left you can see the fields in the database.
Double click on "slag" and this will appear under "Provider specific filter expression".
Click on "=" and this will appear under "Provider specific filter expression".
Under "Values" on the right, click on "All" and a list with all values for "slag" will appear.
Double click on "Rottangi" and this will appear under "Provider specific filter expression".
Click on "OK".
Now we only have "rottangar" left in "kloakk_lutir". We now have cadastre, house numbers and septic tanks.
Then we start our search.
Go to "Vector" in the top menu and choose "Spatial Query". Then again choose "Spatial Query" on the right.
Under "Select source features from" we choose the layer we want to search IN.
Under "Where the feature" we choose the METHOD for our search.
Under "Reference features of" we choose the layer we search FOR.
In other words, we are asking for this: "Find all cadastres, which contain a house number".
We are told, that out of totally 5901 cadastres we found 4511 cadastres with house number.
Click on the icon "Create layer with selected".
Click on "Close".
Now we got a new layer named "M55_oki_selected".
This layer contains only the cadastres, that we found, which means all cadastres with houses.
Now disable the original layer "M55_oki" by removing the "x" from the box in front of the layer name.
In case of you can not see some of the layers, for example "kloakk_lutir", please pull this layer above the other layers with your mouse, so that this layer appears at the top of the list in the left panel.
When a layer is in the top of the list in the left panel, this layer is also at the top in the map, which means that the list in the left panel decides the layer order in the map.
Now the map only contains cadastres with houses.
We will go further in our search.
Go to "Vector" in the top menu and choose "Spatial Query". Then choose "Spatial Query" again on the right.
Under "Select source features from" we choose "M55_oki selected".
Under "Where the feature" we choose "Contains".
Under "Reference features of" we choose "Kloakk_lutir".
That means, we are asking for this: "Find all cadastres with houses, which contains septic tanks".
We are told, that out of totally 4511 cadastres, we found 2662 cadastres with septic tanks.
Click on "Close".
We now see that cadastres with septic tanks are marked with yellow.
Cadastres without septic tanks are blue.
Click on the icon "Open attribute table".
Click on the icon "Invert selection".
Close this box.
We did now invert the selection.
Now cadastres with no septic tank became yellow and cadastres with septic tank became blue.
Again click on "Open attribute table".
Choose "Show Selected Features" at the bottom.
We now have the data of cadastres in our city, with houses, but with no septic tank, in a table.
Click on the empty area between the rows and the columns.
Click CTRL+C (copy).
Now you can open for example Excel and paste the copied data from the clipboard there.
Then you can continue to work with the data in Excel.
You are welcome to write comments below. If you have any questions, please post in the forum.