Lecture 6 GIS Ss
Lecture 6 GIS Ss
1
Query classification
The aim of spatial selection and analysis is to determine spatial relationships between one or more
subjects in order to locate those elements in space to be used for decision making.
• Thematic query:
• Geometric query:
• Topological query:
Query operators
A particular feature that distinguishes a GIS is the possibility to query specific thematic information
about selected objects.
The thematic query relies on the analysis of technical data (attribute data).
The query is performed using adequate selecting operators.
Relational operators: Equal and not equal greater than, smaller …………
Arithmetic operators: These operators are used for numeric attributes. E.g. there is the possibility
to calculate the mean of an attribute or the sum of attribute values from a series of objects.
Logic operators: Conditions are formulated with logic operators. The semantics (meaning) of these
operators are similar to the meaning "AND", "OR" etc.
The relational operators are used for numeric attributes and text attributes and other data types.
The comparisons "greater than", "less than" etc. are related to the position of an "alphabetical" order used in
a computer.
SQL provides the following additional functions for analysis (aggregate functions):
•Avg function (average)
•Count function (number)
•Min, Max function (minimum, maximum)
Shape ID Tree Type Density / Soil type
m2
polygon 1 Fitch 250 sandy
polygon 2 Tanne 250 silt
polygon 3 Khals 0 sandy
polygon 4 Larche 120 clay
polygon 5 Bunch 300 wet
polygon 6 Fitch 130 dry
polygon 7 Larche 100 clay
Shape ID Tree Type Density / m2 Soil type
SQL operator
SELECT * FROM trees WHERE Treetype = 'Fichte';
Result Table Result Graph
Shape ID Tree Type Density / Soil type
m2
polygon 1 Fitch 250 sandy
polygon 6 Fitch 130 dry
Shape ID Tree Type Density / m2 Soil type
SQL operator
SELECT Tree Type, Denisty, Soil type FROM trees WHERE
Soil type = ‘clay'; Result Graph
Result Table
Tree Type Density / m2 Soil type
SQL operator
SELECT *FROM Trees WHERE Denisty >= (SELECT AVG
(Density) FROM trees); Result Graph
Result Table
Shape ID Tree Type Density / m2 Soil type
For example, there is the possibility to calculate the mean or the sum of attribute
values from a series of objects.
SQL operator
SELECT Tree Type, Denisty, soil type, denisty *2/100 as
wood usage FROM Parzelle WHERE Vorrat > 120;
Result Graph
Result Table
Shape ID Tree Type Density / Soil type Wood
m2 usage
polygon 1 Fitch 250 sandy 5
polygon 2 Tanne 250 silt 5
polygon 5 Bunch 300 wet 6
polygon 6 Fitch 130 dry 2.6
logical operators are used to combine the expressions (with two possible values "true" or "false").
Set difference
NOT True, if one is false.
(complement)
Shape ID Tree Type Density / m2 Soil type
polygon 1 Fitch 250 sandy
polygon 2 Tanne 250 silt
polygon 3 Kahls 0 sandy
polygon 4 Larche 120 clay
polygon 5 Bunch 300 wet
polygon 6 Fitch 130 dry
polygon 7 Larche 100 clay
XOR Find all areas that are forested with larch or where the stock is greater than
which do not meet both of these conditions.
110m3/ha, but from Trees
where Tree Type= "Lärche"
xor Vorrat > 110
E.g.: "Select all the houses that are located less than 250 m away
from the river".
Geometry is a property of an object, just as is the thematic. With the appropriate measuring
functions, queries can be performed. The general geometric queries are listed below:
•Buffering features