9953056974 ,Low Rate Call Girls In Adarsh Nagar Delhi 24hrs Available
Practical 7a
1. Multidisciplinary Centre for Geoinformatics
Delhi Technological University
Shahbad Daulatpur, Bawana Road, Delhi – 110042
LAB NO. 7 a
Aim
To get familiar with constructing spatial queries in QGIS
What you should be able to do after this practical?
Perform spatial queries on various features based on location and relationships
Software involved and DATA required
Software: QGIS – 3.20.3
Data: https://dst-iget.in/assets/zip/IGET_GIS_010_Data.zip
Principle/Concept/Background theory
1. What is a spatial relation?
A connection between spatial features concerning their spatial arrangements and
spatial locations. Spatial relations can be of three types: proximity relations,
topological relations and direction relations.
2. What are spatial queries?
A spatial query selects features based on their spatial relationships to other features
and are used to answer spatial questions
2. METHODOLOGY
Query 1: Find out the road segments in Maharashtra where road cross over the
river.
Data used: Shape files- ‘road_maha.shp’ and ‘River_Maha.shp’
Step 1: Open the QGIS Desktop from start menu
Step 2: In Menu bar: Layer > Add Layer > Add Vector Layer
Step 3: Add the vector Dataset(s) i.e., road_maha.shp and River_Maha.shp by Browsing.
Step 4: To perform spatial query by location.
Go to Vector > Research Tools > Select by Location
Or
Processing > Toolbox
3. Type ‘Select by location’ and chose the tool
Step 5: In the window opened,
Select Features from: Select ‘road_maha’ from the drop down list
Where the features (geometric predicate): Check the box beside ‘cross’
By Comparing to the features from: Select ‘River_Maha’
Modify current selection by: creating new selection
Click on Run
4. Step 6: The process takes some time to run.
Step 7: Close the window. You will notice that all the corresponding features are
highlighted in yellow color.
5. Step 8: To save the selected features as separate layer. Right click on the ‘road_maha’
layer in the Layer Bar (in the left) and Export > Save Selected Features As
Step 9: Save the layer with Format “ESRI Shapefile”
Step 10: To move to next query, deselect the selected features.
6. On selection toolbar, use ‘Deselect Features from all Layers’ option
Query 2: Find out the river channels that are not flowing through Ahmadnagar
District.
Data used: Shape files- ‘Maha_Tehsil.shp’ and ‘River_Maha.shp’
Step 1: Open the QGIS Desktop from start menu
Step 2: In Menu bar: Layer > Add Layer > Add Vector Layer
Step 3: Add the vector Dataset(s) i.e., Maha_Tehsil.shp and River_Maha.shp by
Browsing (keep the River_Maha layer on top of Maha_Tehsil layer)
7. Step 4: Since we want rivers flowing outside Ahmadnagar, firstly we will select
Ahmadnagar district from the Maharashtra state.
This can be done by using attribute query and we will perform spatial query on the
selected data from attribute query.
Right click on ‘Maha_Tehsil’ and select ‘Filter’.
Step 5: The query builder window gets opened. In this window, Select all the tehsils of
Ahmadnagar district by using attribute query, i.e., double click on "NAME_2" fromfields
window and click on click on ‘=’ in the ‘Operators’ section
8. Step 6: Then to see all the values in Name_2 field click on ‘All’ in ‘Values’ section in
window and select Ahmednagar from values
Step 7: In short we need to create an expression "NAME_2" = 'Ahmednagar' and Click
‘OK’.
9. Step 8: This will select all the tehsils from Ahmednagar district.
Step 9: To perform spatial query by location.
Go to Vector > Research Tools > Select by Location
Or
Processing > Toolbox
Type ‘Select by location’ and chose the tool
10. Step 10: In the window opened,
Select Features from: Select ‘River_Maha’ from the drop down list
Where the features (geometric predicate): Check the box beside ‘disjoint’
By Comparing to the features from: Select ‘Maha_Tehsil’
And use the result to: Create new selection
Click Apply
Click on Run
Step 11: The process takes some time to run.
Step 12: The river channels which are not flowing through Ahmadnagar would be
highlighted in yellow color in map canvas.
11. Step 13: To save the selected features as separate layer. Right click on the
‘River_Maha’ layer in the Layer Bar (in the left) and Export > Save Selected Features As
Step 14: Save the layer with Format “ESRI Shapefile”
Step 15: To move to next query, deselect the selected features.
On selection toolbar, use ‘Deselect Features from all Layers’ option
Query 3: Find out the public places that are within Greater Mumbai.
12. Data used: Shape files- ‘Maha_Tehsil.shp’ and ‘public_place_maha.shp’
Step 1: Open the QGIS Desktop from start menu
Step 2: In Menu bar: Layer > Add Layer > Add Vector Layer
Step 3: Add the vector Dataset(s) i.e., Maha_Tehsil.shp and public_place_maha.shp by
Browsing (keep the public_place_maha layer on top of Maha_Tehsil layer)
Step 4: Since we want public places inside Greater Mumbai, firstly we will select Greater
Bombay district from the Maharashtra state.
This can be done by using attribute query and we will
perform spatial query on the selected data from attribute
query.
Right click on ‘Maha_Tehsil’ and select ‘Filter’.
13. Step 5: The query builder window gets opened. In this window, Select all the tehsils of
Greater Bombay district by using attribute query, i.e., double click on "NAME_2" from
fields window and click on click on ‘=’ in the ‘Operators’ section.
Then to see all the values in Name_2 field click on ‘All’ in ‘Values’ section in window and
select Greater Bombay from values
In short we need to create an expression "NAME_2" = 'Greater Bombay' and Click ‘OK’.
Step 6: This will select all the tehsils
from Greater Bombay
14. Step 7: To perform spatial query by location.
Go to Vector > Research Tools > Select by Location
Or
Processing > Toolbox
Type ‘Select by location’ and chose the tool
Step 8: In the window opened,
Select Features from: Select ‘public_place_maha’ from the drop down list
Where the features (geometric predicate): Check the box beside ‘are within’
By Comparing to the features from: Select ‘Maha_Tehsil’
And use the result to: Create new selection
Click Apply
15. Click on Run
Step 9: The process takes some time to run. The public places which are present in the
Greater Bombay region gets highlighted in yellow
16. Step 10: To save the selected features as separate layer. Right click on the
‘public_place_maha’ layer in the Layer Bar (in the left) and Export > Save Selected
Features As
Step 11: Save the layer with Format “ESRI Shapefile”
Step 12: To move to next query, deselect the selected features.
On selection toolbar, use ‘Deselect Features from all Layers’ option
17. Query 4: Find out the schools in Maharashtra that could be affected by floods?
Let assume the flood zone is at about 3 km from the river bank.
Data used: Shape files- ‘School_col_Maha.shp’ and ‘River_Maha.shp’
Step 1: Open the QGIS Desktop from start menu
Step 2: In Menu bar: Layer > Add Layer > Add Vector Layer
Step 3: Add the vector Dataset(s) i.e., School_col_Maha.shp and River_Maha.shp by
Browsing
18. Step 4: To find out Rivers that could be affecting the schools in case floods, firstly we
have to create a flood zone around the rivers with 3 Km by using Buffer function. To
create a buffer around the river, Menu bar > Vector > Geoprocessing tools > Buffer…
Step 5: The ‘Buffer…’ window will open. Select Input vector layer as ‘River_Maha’.
Specify ‘Buffer Distance’ as 3km (Since our working unit is meter in UTM projection).
Rest of the parameters same. Save the output shapefile ( in desired location in local
drive with a proper name. This can be done with the help of browse button. Once the
inputs are given properly click on ‘OK’. If you asked to add the output layer to map canvas
click on yes.
Close the Buffer window and the output layer looks as follows:
19. Move the ‘School_col_Maha’ layer on the top of this newly created buffer layer.
Step 6: To perform spatial query by location.
Go to Vector > Research Tools > Select by Location
Or
Processing > Toolbox
Type ‘Select by location’ and chose the tool
20. Step 7: In the window opened,
Select Features from: Select ‘School_col_Maha’ from the drop down list
Where the features (geometric predicate): Check the box beside ‘are within’
By Comparing to the features from: Select ‘Buffer’
And use the result to: Create new selection
Click Apply
Click on Run
Step 8: The process takes some time to run. The schools which are present in the 3 KM
region to the rivers gets highlighted in yellow
21. Step 9: To save the selected features as separate layer. Right click on the
‘School_col_maha’ layer in the Layer Bar (in the left) and Export > Save Selected
Features As
22. Step 10: Save the layer with Format “ESRI Shapefile”
Step 11: To move to next query, deselect the selected features.
On selection toolbar, use ‘Deselect Features from all Layers’ option
Query 5: Find out the tehsils in Pune which contains water bodies such as lakes
and Dams?
Data used: Shape files- ‘waterbodies_maha.shp’ and ‘Maha_Tehsil.shp’
Step 1: Open the QGIS Desktop from start menu
Step 2: In Menu bar: Layer > Add Layer > Add Vector Layer
23. Step 3: Add the vector Dataset(s) i.e., waterbodies_maha.shp and Maha_Tehsil.shp by
Browsing (Keep the waterbodies_Maha layer over Maha_Tehsil)
Step 4: Since we want water bodies inside Pune, firstly we will select Pune district from
the Maharashtra state.
This can be done by using attribute query and we will perform spatial query on the
selected data from attribute query.
Right click on ‘Maha_Tehsil’ and select ‘Filter’.
Step 5: The query builder window gets opened. In this window, Select all the tehsils of
Pune district by using attribute query, i.e., double click on "NAME_2" from fields window
and click on click on ‘=’ in the ‘Operators’ section.
Then to see all the values in Name_2 field click on ‘All’ in ‘Values’ section in window and
select Pune from values
In short, we need to create an expression "NAME_2" = 'Pune' and Click ‘OK’.
24. Step 6: This will select all the tehsils from Pune.
Step 7: To perform spatial query by location.
25. Go to Vector > Research Tools > Select by Location
Or
Processing > Toolbox
Type ‘Select by location’ and chose the tool
Step 8: In the window opened,
Select Features from: Select ‘Maha_Tehsil’ from the drop down list
Where the features (geometric predicate): Check the box beside ‘contain’
By Comparing to the features from: Select ‘waterbodies_Maha’
And use the result to: Create new selection
Click Apply
26. Click on Run
Step 9: The process takes some time to run. The tehsils of Pune which contain water
bodies gets highlighted in yellow.
27. Step 10: To save the selected features as separate layer. Right click on the
‘Maha_tehsil’ layer in the Layer Bar (in the left) and Export > Save Selected Features
As
Step 11: Save the layer with Format “ESRI Shapefile”
Step 12: deselect the selected features.
On selection toolbar, use ‘Deselect Features from all Layers’ option
28. Observations
1. Correctly define the options: Select Features from and By comparing to the
features from
2. Selection and Extraction of required features can be done by this practical.
TEST YOUR KNOWLEDGE
1. How can we find the number of schools affected by the flood in Query 4 ?
2. What are the various types of spatial relations?
3. Is there any other way to select and save the required queried features
directly ?