0% found this document useful (0 votes)
20 views

Lecture 6 GIS Ss

Uploaded by

Mohamed elkholy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Lecture 6 GIS Ss

Uploaded by

Mohamed elkholy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

GIS lecture 6:

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.

Three approaches for GIS queries

• 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.

Three categories of operators are presented:

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.

Relational operators other spellings are used


= EQ (equal to)
> GT (greater than)
>= GE (greater than or equal to)
< LT (less than)
<= LE (less than or equal to)
<> NE (not equal to)

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

polygon 1 Fitch 250 sandy


polygon 2 Tanne 250 silt
polygon 3 Khals 0 sandy
polygon 4 Larch 120 clay
polygon 5 Bunch 300 wet
polygon 6 Fitch 130 dry
polygon 7 Larche 100 clay

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

polygon 1 Fitch 250 sandy


polygon 2 Tanne 250 silt
polygon 3 Khals 0 sandy
polygon 4 Larch 120 clay
polygon 5 Bunch 300 wet
polygon 6 Fitch 130 dry
polygon 7 Larche 100 clay

SQL operator
SELECT Tree Type, Denisty, Soil type FROM trees WHERE
Soil type = ‘clay'; Result Graph
Result Table
Tree Type Density / m2 Soil type

Larche 120 clay


Larche 100 clay
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

SQL operator Result Graph


SELECT * FROM trees WHERE Denisty >120;
Result Table
Shape ID Tree Type Density / m2 Soil type

polygon 1 Fitch 250 sandy


polygon 2 Tanne 250 silt
polygon 5 Bunch 300 wet
polygon 6 Fitch 130 dry
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

SQL operator
SELECT *FROM Trees WHERE Denisty >= (SELECT AVG
(Density) FROM trees); Result Graph
Result Table
Shape ID Tree Type Density / m2 Soil type

polygon 1 Fitch 250 sandy


polygon 2 Tanne 250 silt
polygon 5 Bunch 300 wet
Arithmetic operators are used for numerical attributes.

For example, there is the possibility to calculate the mean or the sum of attribute
values from a series of objects.

The following operators can be used as arithmetic operators:


Multiplication (*), division (/), addition (+) and subtraction (‐) as well as the
exponent operator (exp) and modulo operator (%).
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

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").

Logical operators Meaning Result Venn diagrams

AND Intersection True, if both are true.

OR Union True, if at least one is true.

Symmetric difference; True, if exactly one is true,


XOR
excluding OR but not both.

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

Operator Query SQL


Select Tree Type, Density, soil type
Find all areas that are forested with larch and where the Density from trees
AND is greater than 110 where Btree type = "Larche"and
Density > 110

Result Table Result Graph


Shape ID Tree Type Density / m2 Soil type
polygon 4 Larche 120 clay
Operator Query SQL
Select Tree Type, Density, soil type
Find all areas that are forested with larch and where the Density from trees
AND is greater than 110 where Btree type = "Larche"and
Density > 110

Shape ID Tree Type Density / m2 Soil type


polygon 4 Larche 120 clay
Circle 1 : Tree type = "larche"
Circle 2 : Density > 110 m3/ha
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

operator Query SQL


select ID, Tree Type, Density
Find all areas that are forested with larch or where the Density from trees
OR is greater than 110m3/ha. where Tree Typet = "Lärche"
or Density > 110

Result Table Shape ID Tree Type Density / m2 Result Graph


polygon 1 Fitch 250
polygon 2 Tanne 250
polygon 4 Larche 120
polygon 5 Bunch 300
polygon 6 Fitch 130
polygon 7 Larche 100
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

Operator Query SQL


select ID, Tree Type, VoDensity

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

Result Table Shape ID Tree Type Density / m2 Result Graph


polygon 1 Fitch 250
polygon 2 Tanne 250
polygon 5 Bunch 300
polygon 6 Fitch 130
polygon 7 Larche 100
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

Result Table Shape ID Tree Type Density / m2 Result Graph


polygon 1 Fitch 250
polygon 2 Tanne 250
polygon 5 Bunch 300
polygon 6 Fitch 130
polygon 7 Larche 100
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

Operator Query SQL


select ID, Tree Type, Density
Find all areas which are forested with larch but where the from trees
NOT
stock is not greater than 110m3/ha. where Tree type = "Lärche"
not Denisty > 110
Result Graph
Result Table
Shape ID Tree Type Density / m2
polygon 7 Larche 100
Proximity relations are distance-based

Selection of all objects which achieve the required spatial conditions.

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:

Position – where (x, y)?


Raster Model
Vector model
Returns the position of each point from the map as x‐ and y‐coordinates.
Vector model
Returns the position of each point from the map as x‐ and y‐coordinates.
No.
Value Location
Cell
4,2 5,2 6,2
4,3 5,3
1 8
4,4 5,4
5,5
7,2
6,3 7,3
2 7
6,4 7,4
6,5 7,5
•Locating features based on their distance from other features

•Buffering features

•Spatial Join – closest features


•Can add a buffer to a point, line, or polygon
•Pay attention to map units when specifying buffer
distance
Buffer around selected points at
Buffer around selected points 20 Km with dissolved boundaries
at 30 Km.
Buffer with 3 rings at 5 Km distance, overlapping boundaries.
Inside and outside the polygon boundary with a 5 Km buffer.
Polygon buffer including the polygon

You might also like