0% found this document useful (0 votes)
20 views22 pages

Indexing of Spatial Data

Uploaded by

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

Indexing of Spatial Data

Uploaded by

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

3D-ModIS Indexing of Spatial Data

k-d tree - early structure used for indexing in multiple dimensions.

Each level of a k-d tree partitions the space into two.


choose one dimension for partitioning at the root level of the tree.
choose another dimensions for partitioning in nodes at the next level
and so on, cycling through the dimensions.

In each node, approximately half of the points stored in the sub-
tree fall on one side and half on the other.
Partitioning stops when a node has less than a given maximum
number of points.
The k-d-B tree extends the k-d tree to allow multiple child nodes
for each internal node; well-suited for secondary storage.

Deni Suwardhi – Spatial Database Lecture 1


3D-ModIS Division of Space by a k-d Tree

Each line in the figure (other than the outside box) corresponds to
a node in the k-d tree
the maximum number of points in a leaf node has been set to 1.

The numbering of the lines in the figure indicates the level of the
tree at which the corresponding node appears.

Deni Suwardhi – Spatial Database Lecture 2


3D-ModIS Division of Space by Quadtrees
Quadtrees
 Each node of a quadtree is associated with a rectangular region of space; the top
node is associated with the entire target space.
 Each non-leaf node divides its region into four equal sized quadrants
 correspondingly each such node has four child nodes corresponding to the four quadrants
and so on

 Leaf nodes have between zero and some fixed maximum number of points (set to 1
in example).

Deni Suwardhi – Spatial Database Lecture 3


3D-ModIS Quadtrees (Cont.)
PR quadtree: stores points; space is divided based on regions,
rather than on the actual set of points stored.
Region quadtrees store array (raster) information.
A node is a leaf node is all the array values in the region that it covers are
the same. Otherwise, it is subdivided further into four children of equal
area, and is therefore an internal node.
Each node corresponds to a sub-array of values.
The sub-arrays corresponding to leaves either contain just a single array
element, or have multiple array elements, all of which have the same
value.

Extensions of k-d trees and PR quadtrees have been proposed to


index line segments and polygons
Require splitting segments/polygons into pieces at partitioning boundaries
Same segment/polygon may be represented at several leaf nodes

Deni Suwardhi – Spatial Database Lecture 4


3D-ModIS R-Trees
R-trees are a N-dimensional extension of B+-trees,
useful for indexing sets of rectangles and other polygons.
Supported in many modern database systems

Basic idea: generalize the notion of a one-dimensional


interval associated with each B+ -tree node to an
N-dimensional interval, that is, an N-dimensional
rectangle.
Will consider only the two-dimensional case (N = 2)
generalization for N > 2 is straightforward

Deni Suwardhi – Spatial Database Lecture 5


3D-ModIS Bounding Rectangle
• Suppose we have a cluster of points in
2-D space...
– We can build a “box” around points. The
smallest box (which is axis parallel) that
contains all the points is called a Minimum
Bounding Rectangle (MBR)
• also known as minimum bounding box

MBR = {(L.x,L.y)(U.x,U.y)}
Note that we only need two points to describe an MBR, we
typically use lower left, and upper right.
6
Deni Suwardhi
3D-ModIS Clustering Points
 We can group clusters of datapoints
into MBRs
Can also handle line-segments, rectangles,
polygons, in addition to points

R1 R4
We can further recursively
R group MBRs into larger
2 R5
MBRs….
R3 R6

R9
R7
R8
7
Deni Suwardhi
3D-ModIS R-Tree Structure

 Nested MBRs are organized as a tree

R10 R11

R10 R11
R12

R1 R2 R4 R5 R7 R8
R3 R6 R9

R12 Data nodes containing


points
8
Deni Suwardhi
3D-ModIS R Trees (Cont.)
 A rectangular bounding box (a.k.a. MBR) is associated with
each tree node.
Bounding box of a leaf node is a minimum sized rectangle that
contains all the rectangles/polygons associated with the leaf node.
The bounding box associated with a non-leaf node contains the
bounding box associated with all its children.
Bounding box of a node serves as its key in its parent node (if
any)
Bounding boxes of children of a node are allowed to overlap

A polygon is stored only in one node, and the bounding box


of the node must contain the polygon
The storage efficiency or R-trees is better than that of k-d trees or
quadtrees since a polygon is stored only once

Deni Suwardhi – Spatial Database Lecture 9


3D-ModIS Example R-Tree
 A set of rectangles (solid line) and the bounding boxes
(dashed line) of the nodes of an R-tree for the
rectangles. The R-tree is shown on the right.

Deni Suwardhi – Spatial Database Lecture 10


3D-ModIS Search in R-Trees
 To find data items (rectangles/polygons) intersecting (overlaps) a given
query point/region, do the following, starting from the root node:
 If the node is a leaf node, output the data items whose keys intersect the given query
point/region.
 Else, for each child of the current node whose bounding box overlaps the query
point/region, recursively search the child

 Can be very inefficient in worst case since multiple paths may need to be
searched
 but works acceptably in practice.

 Simple extensions of search procedure to handle


 predicates contained-in and contains
 Find data items nearest to a given point
 Find data items within a given distance of a given point

Deni Suwardhi – Spatial Database Lecture 11


3D-ModIS Nearest Neighbor Search
• Given an MBR, we can compute lower bounds on nearest object

• Once we know there IS an item within some distance d, we can


prune away all items/MBRs at distance > d
– Even if we haven’t actually found the nearest item yet
– Similar technique possible for k-d trees and quadtrees as well

Q
R10 R11
R10 R11
R12

R1 R2 R4 R5 R7 R8
R3 R6 R9

R12 Data nodes containing


points 12
Deni Suwardhi
3D-ModIS MBR: Distance Calculation

The formula for the distance between a point and


the closest possible point within an MBR
MBR = {(L.x,L.y)(U.x,U.y)}
Q=
(x,y)

MINDIST(Q,MBR)

if L.x < x < U.x and L.y < y < U.y then 0
elseif L.x < x < U.x then min( abs(L.y -y) , abs(U.y -y) )
elseif ….

13
Deni Suwardhi – Spatial Database Lecture
3D-ModIS MBR: Distance Example

Two examples of MINDIST(point, MBR),


calculations…

MINDIST(point, MBR) = 5 MINDIST(point, MBR) = 0

14
Deni Suwardhi – Spatial Database Lecture
3D-ModIS
MBR: Distance Bounds
 Distance bounds on bounding boxes
 Suppose we have a query point Q and one known point R
 Could any of the points in the MBR be closer to Q than R
is?

R = (1,7)

Q=
(3,5)
MBR = {(6,1),(8,4)}

15
Deni Suwardhi – Spatial Database Lecture
SPATIAL
PREDICATE
RV-2018
DE-9IM
The Dimensionally Extended nine-Intersection
Model (DE-9IM) is a topological model and a
standard used to describe the spatial relations of two
regions (two geometries in two-dimensions, R2), in
Geometry, Point-set topology, Geospatial topology,
and fields related to computer spatial analysis. Since
the spatial relations expressed by the model are
topological they are invariant to rotation, translation
and scaling transformations.
The matrix provides an approach for classifying
geometry relations. Roughly speaking, with a
true/false matrix domain, there are 512 possible 2D
topologic relations, that can be grouped into binary
classification schemes. For English speakers, there
are about 10 schemes (relations) that have a name
that reflects their semantics (e.g. "Intersects",
"Touches", "Equals", and others.) When testing two
geometries against a scheme, the result of this test is
a spatial predicate named by the scheme.
Matrix Model
The DE-9IM model is based on a 3×3 intersection matrix with the
form:
Illustration

• Visually, for two


overlapping
polygonal,
geometries, this
look like :
String Code

You might also like