34
Spatial Information Spatial Information Systems (SIS) Systems (SIS) COMP 30110 COMP 30110 Spatial queries and operations Spatial queries and operations

Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

  • View
    231

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Spatial Information Systems (SIS)Spatial Information Systems (SIS)

COMP 30110COMP 30110

Spatial queries and operationsSpatial queries and operations

Page 2: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Spatial Spatial queriesqueries

• ExamplesExamples::

- “What are the two post offices nearest to Dun - “What are the two post offices nearest to Dun Laoghaire dart station?” (proximity query)Laoghaire dart station?” (proximity query)

- “In what county is Bray?” (containment query)- “In what county is Bray?” (containment query)

- “What are Italy’s neighbouring countries” - “What are Italy’s neighbouring countries” (adjacency query)(adjacency query)

- “What Italian regions are crossed by the river Po?” - “What Italian regions are crossed by the river Po?” (intersection/overlap query)(intersection/overlap query)

Etc…Etc…

Page 3: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Non-spaNon-spatial tial queriesqueries

• Examples:Examples:

- “What is the population of Dublin City?”- “What is the population of Dublin City?”

- “How long is the river Shannon”- “How long is the river Shannon”

(assuming that population and length are attributes (assuming that population and length are attributes stored for city and river, respectively)stored for city and river, respectively)

These are standard DB queries that request to These are standard DB queries that request to retrieve the value of some attribute. Spatial queries, retrieve the value of some attribute. Spatial queries, on the other hand, require different type of on the other hand, require different type of computations.computations.

Page 4: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Examples of theme queriesExamples of theme queries

• Let us consider Let us consider thematic mapsthematic maps

• What are the typical “non-spatial” queries that users What are the typical “non-spatial” queries that users might want to perform on these type of maps?might want to perform on these type of maps?

• Theme projectionTheme projection

• Theme selectionTheme selection

• Theme unionTheme union

• Etc.Etc.

• Same as relational algebra operatorsSame as relational algebra operators

Page 5: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme queriesTheme queries

Theme projectionTheme projection: it is a non-spatial operation that : it is a non-spatial operation that works as the works as the projection projection operation from relational operation from relational algebraalgebra

ExampleExample: in a political map of European countries with : in a political map of European countries with attributes attributes namename and and populationpopulation, we want to project on , we want to project on the attribute the attribute populationpopulation (i.e., we eliminate the country (i.e., we eliminate the country names) names)

Page 6: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme projectionTheme projection

Thematic map of countries of western Europe (and their Thematic map of countries of western Europe (and their population); projection on the attribute population); projection on the attribute populationpopulation

Page 7: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme queries (cont.d)Theme queries (cont.d)

Theme selectionTheme selection: it is a non-spatial operation (based on : it is a non-spatial operation (based on a non-spatial predicate) that works as the a non-spatial predicate) that works as the selection selection operation from relational algebraoperation from relational algebra

ExampleExample: in a political map of European countries, : in a political map of European countries, select all names and population of countries with more select all names and population of countries with more than 50M inhabitantsthan 50M inhabitants

Page 8: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme selectionTheme selection

Thematic map of countries of western Europe (and their Thematic map of countries of western Europe (and their population); selection of countries with more than 50M peoplepopulation); selection of countries with more than 50M people

Page 9: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme queries (cont.d)Theme queries (cont.d)

Theme unionTheme union: it is a non-spatial operation that works as : it is a non-spatial operation that works as the the union union operation from relational algebra. It can only operation from relational algebra. It can only be applied to thematic maps with same attribute be applied to thematic maps with same attribute schemaschema

ExampleExample: union of the map containing European : union of the map containing European countries with more than 10M inhabitants and the map countries with more than 10M inhabitants and the map containing European countries with less than 10M containing European countries with less than 10M inhabitants. The two maps both have schema (inhabitants. The two maps both have schema (name, name, populationpopulation))

Page 10: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Theme unionTheme union

Thematic map of Thematic map of countries (and countries (and population) of western population) of western Europe with less than Europe with less than 10M inhabitants10M inhabitants

Thematic map of Thematic map of countries (and countries (and population) of population) of western Europe with western Europe with more than 10M more than 10M inhabitantsinhabitants

Page 11: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Types of spatial queries/operationsTypes of spatial queries/operations

• Containment QueryContainment Query

• Region QueryRegion Query

• Enclosure QueryEnclosure Query

• ClippingClipping

• Line intersection queryLine intersection query

• Adjacency queryAdjacency query

• Metric (Proximity) QueriesMetric (Proximity) Queries

• Spatial JoinSpatial Join

• Map OverlayMap Overlay

• Merge/AggregationMerge/Aggregation

Page 12: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queriesBasic spatial queries

Containment QueryContainment Query: Given a spatial object : Given a spatial object OO, find all , find all objects in the map that completely contain objects in the map that completely contain O.O. When When OO is a point, the query is called is a point, the query is called Point QueryPoint Query

O

P

Containment Query Point Query

(also Point-in-polygon, or Point Location)

Page 13: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Region QueryRegion Query: Given a region : Given a region RR, find all objects in the , find all objects in the map that intersect map that intersect R.R. When When RR is a rectangle, the query is a rectangle, the query is called is called Window QueryWindow Query

R R

Region Query Window Query

Page 14: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Window queryWindow query

A thematic map A thematic map MM and windowing of and windowing of MM with area with area AA

Page 15: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Enclosure QueryEnclosure Query: Given a region : Given a region RR, find all objects in , find all objects in the map that are completely contained in the map that are completely contained in RR

R

Enclosure Query

Page 16: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

ClippingClipping: Given a region : Given a region RR, extract all portions of , extract all portions of objects in the map that are contained in objects in the map that are contained in R. R. Note that the Note that the geometry of an object in the result corresponds to the geometry of an object in the result corresponds to the intersectionintersection of the object with the window of the object with the window

R

Clipping

Page 17: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

ClippingClipping

A thematic map A thematic map MM and clipping of and clipping of MM with area with area AA

Page 18: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Line intersection queryLine intersection query: Given a line : Given a line ll, extract all objects , extract all objects in the map that intersect in the map that intersect l. l. ExampleExample: : “What counties “What counties are crossed by the river Shannon?”are crossed by the river Shannon?”

l

Line intersection

Page 19: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Adjacency queryAdjacency query: Given an object : Given an object OO, extract all objects in , extract all objects in the map that are adjacent to the map that are adjacent to OO (i.e., share a bounding (i.e., share a bounding entity with entity with OO)). . ExampleExample: : “What are Italy’s neighbouring “What are Italy’s neighbouring countries?”countries?”

O

Adjacency query

Page 20: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Metric QueriesMetric Queries: they involve distances. : they involve distances. ExampleExample: Given : Given two objects two objects O O andand O’ O’ how far are they from each other?how far are they from each other? Obvious for points. For regions, usually distance Obvious for points. For regions, usually distance between their centroidsbetween their centroids

Metric queries are also called Metric queries are also called proximityproximity queries queries

O

Distance query

O’

Page 21: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Nearest Neighbour QueryNearest Neighbour Query: Given an object : Given an object OO, find the , find the object in the map that is closest to object in the map that is closest to O O (typically for (typically for points) points)

Also: K-nearest neighbour query: find the k nearest Also: K-nearest neighbour query: find the k nearest objectsobjects

Nearest Neighbour Query

O

Page 22: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Range QueryRange Query: Given an object : Given an object OO, find all objects in the , find all objects in the map that are within a given distance map that are within a given distance dd from from O O (typically (typically for points) for points)

Range Query

O

d

Page 23: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Spatial JoinSpatial Join: Given two sets of spatial object : Given two sets of spatial object SS andand S’S’, , find all pairs (find all pairs (O,O’) O,O’) of objects such that:of objects such that:

– OO SS, , O’O’ S’S’

– OO O’O’

{{OO11 ,…,,…,OO66} {} {O’O’1 1 ,…,,…,O’O’55} = } =

((OO11 , , O’O’1 1 ), (), (OO22 , , O’O’1 1 ), (), (OO66 , , O’O’1 1 ), ),

((OO44 , , O’O’3 3 ), (), (OO55 , , O’O’3 3 ), (), (OO55 , , O’O’5 5 ), ),

((OO33 , , O’O’2 2 ))

• Spatial predicates other than intersection are also Spatial predicates other than intersection are also possible. possible. ExampleExample: all pairs of objects that are within a : all pairs of objects that are within a given distance from each other, etc.given distance from each other, etc.

Spatial Join

O2

O4O1

O6

O5

O3

O’4

O’1

O’3

O’2

O’5

Page 24: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Map OverlayMap Overlay: given two maps : given two maps M M and and M’M’, return a third , return a third map that contains objects from map that contains objects from M M and and M’M’ and new and new objects whose geometry corresponds to the intersection objects whose geometry corresponds to the intersection of objects belonging to of objects belonging to MM and and M’.M’.

ProcessProcess: perform the : perform the spatial joinspatial join of of M M and and M’. M’. Consider Consider all pairs of intersecting objects. For each such all pairs of intersecting objects. For each such intersection generate a new object and modify the intersection generate a new object and modify the geometry of the two original objects accordinglygeometry of the two original objects accordingly

ExampleExample: political map of wester European countries : political map of wester European countries and map of languages spoken all over western Europeand map of languages spoken all over western Europe

Page 25: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Map OverlayMap Overlay

Overlay of the map of western European Overlay of the map of western European countries and the map of families of countries and the map of families of languages spoken in western Europelanguages spoken in western Europe

Page 26: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Basic spatial queries (cont.d)Basic spatial queries (cont.d)

Merge Query/OperationMerge Query/Operation: Given two (or more) objects : Given two (or more) objects O O and and O’,O’, return their geometric union return their geometric union

This operation is used in This operation is used in map generalisation map generalisation to perform to perform object aggregation (more later on this)object aggregation (more later on this)

Merging two objects

O O’

Page 27: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

MergingMerging

Page 28: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

RemarksRemarks

• Spatial queries involve the geometry of objects and Spatial queries involve the geometry of objects and their spatial relations (in particular, topological queries their spatial relations (in particular, topological queries are based on topological properties)are based on topological properties)

• Therefore, it is important to have data structures that Therefore, it is important to have data structures that “support” efficient computation of geometric properties “support” efficient computation of geometric properties and spatial relationsand spatial relations

Page 29: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Spatial queries and their Spatial queries and their geometric counterpartgeometric counterpart

Some spatial queries involve geometric calculations Some spatial queries involve geometric calculations such as intersection of segments, etc.such as intersection of segments, etc.

Use of computational geometry algorithms in GISUse of computational geometry algorithms in GIS

Page 30: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Point LocationPoint Location

A

GIS queryGIS query: “What state contains city : “What state contains city AA?”?”

Geometric queryGeometric query: “What polygon in the plane subdivision contains : “What polygon in the plane subdivision contains

point point AA?” [Kirkpatrick 1983]?” [Kirkpatrick 1983]

Page 31: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Spatial Queries: Line Spatial Queries: Line IntersectionIntersection

B

GIS queryGIS query: “What states are crossed by river : “What states are crossed by river BB?”?”

Geometric queryGeometric query: “What polygons in the plane subdivision are : “What polygons in the plane subdivision are

intersected by polylineintersected by polyline BB?”?”

Page 32: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Map Overlay Map Overlay

ExampleExample::

Land cover change map Land cover change map andand

county mapcounty map

In GIS: overlay of multiple thematic maps of a given geographic region In GIS: overlay of multiple thematic maps of a given geographic region

Page 33: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Geometric Operations in Map OverlayGeometric Operations in Map Overlay

Overlay of plane subdivisions: Overlay of plane subdivisions: intersection of line intersection of line segmentssegments [Nievergelt and Preparata 1982] [Nievergelt and Preparata 1982]

+ =

Page 34: Spatial Information Systems (SIS) COMP 30110 Spatial queries and operations

Geometric Operations in Geometric Operations in Spatial QueriesSpatial Queries

Other spatial queries such as Other spatial queries such as clipping clipping make extensive make extensive use of use of line intersectionline intersection algorithms algorithms that have been that have been proposed in the field of computational geometryproposed in the field of computational geometry