Docsity

Spatial Data Management in Database Systems: Types, Queries, and Applications, Slides of Database Management Systems (DBMS)

Toggle sidebar
bg1
1
Database management Systems, 3ed, R. Ramakrishnanand J. Gehrke 1
Spatial Data Management
Chapter 28
Database management Systems, 3ed, R. Ramakrishnanand J. Gehrke 2
Types of Spatial Data
Point Data
Points in a multidimensional space
E.g., Raster data such as satellite imagery, where each
pixel stores a measured value
E.g., Feature vectors extracted from text
Region Data
Objects have spatial extent with location and
boundary
DB typically uses geometric approximations
constructed using line segments, polygons, etc.,
called vector data.
Database management Systems, 3ed, R. Ramakrishnanand J. Gehrke 3
Types of Spatial Queries
Spatial Range Queries
Find all cities within 50 miles of Madison
Query has associated region (location, boundary)
Answer includes ovelapping or contained data regions
Nearest-Neighbor Queries
Find the 10 cities nearest to Madison
Results must be ordered by proximity
Spatial Join Queries
Find all cities near a lake
Expensive, join condition involves regions and proximity
pf3
pf4
pf5

Partial preview of the text

Download Spatial Data Management in Database Systems: Types, Queries, and Applications and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1

Spatial Data Management

Chapter 28

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 2

Types of Spatial Data

™ Point Data

ƒ Points in a multidimensional space ƒ E.g., Raster data such as satellite imagery, where each pixel stores a measured value ƒ E.g., Feature vectors extracted from text

™ Region Data

ƒ Objects have spatial extent with location and boundary ƒ DB typically uses geometric approximations constructed using line segments, polygons, etc., called vector data.

Types of Spatial Queries

™ Spatial Range Queries ƒ Find all cities within 50 miles of Madison ƒ Query has associated region (location, boundary) ƒ Answer includes ovelapping or contained data regions ™ Nearest-Neighbor Queries ƒ Find the 10 cities nearest to Madison ƒ Results must be ordered by proximity ™ Spatial Join Queries ƒ Find all cities near a lake ƒ Expensive, join condition involves regions and proximity

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 4

Applications of Spatial Data

™ Geographic Information Systems (GIS) ƒ E.g., ESRI’s ArcInfo; OpenGIS Consortium ƒ Geospatial information ƒ All classes of spatial queries and data are common ™ Computer-Aided Design/Manufacturing ƒ Store spatial objects such as surface of airplane fuselage ƒ Range queries and spatial join queries are common ™ Multimedia Databases ƒ Images, video, text, etc. stored and retrieved by content ƒ First converted to feature vector form; high dimensionality ƒ Nearest-neighbor queries are the most common

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 5

Single-Dimensional Indexes

™ B+ trees are fundamentally single-dimensional

indexes.

™ When we create a composite search key B+ tree,

e.g., an index on <age, sal>, we effectively linearize

the 2-dimensional space since we sort entries first

by age and then by sal.

Consider entries: <11, 80>, <12, 10> <12, 20>, <13, 75>

B+ tree order

Multidimensional Indexes

™ A multidimensional index clusters entries so as to

exploit “nearness” in multidimensional space.

™ Keeping track of entries and maintaining a

balanced index structure presents a challenge!

Consider entries: <11, 80>, <12, 10> <12, 20>, <13, 75>

Spatial clusters

B+ tree order 11 12 13

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 10

R-Tree Properties

™ Leaf entry = < n-dimensional box, rid >

ƒ This is Alternative (2), with key value being a box. ƒ Box is the tightest bounding box for a data object.

™ Non-leaf entry = < n-dim box, ptr to child node >

ƒ Box covers all boxes in child node (in fact, subtree).

™ All leaves at same distance from root.

™ Nodes can be kept 50% full (except root).

ƒ Can choose a parameter m that is <= 50%, and ensure that every node is at least m % full.

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 11

Example of an R-Tree

R

R

R

R

R

R

R

R

R R

R

R

R

R

R

R R

R

R

Leaf entry

Index entry

Spatial object approximated by bounding box R

Example R-Tree (Contd.)

R1 R

R3 R4 R5 R6 R

R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 13

Search for Objects Overlapping Box Q

Start at root.

1. If current node is non-leaf, for each

entry <E, ptr>, if box E overlaps Q,

search subtree identified by ptr.

2. If current node is leaf, for each entry

<E, rid>, if E overlaps Q, rid identifies

an object that might overlap Q.

Note: May have to search several subtrees at each node! (In contrast, a B-tree equality search goes to just one leaf.)

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 14

Improving Search Using Constraints

™ It is convenient to store boxes in the R-tree as

approximations of arbitrary regions, because

boxes can be represented compactly.

™ But why not use convex polygons to

approximate query regions more accurately?

ƒ Will reduce overlap with nodes in tree, and reduce the number of nodes fetched by avoiding some branches altogether. ƒ Cost of overlap test is higher than bounding box intersection, but it is a main-memory cost, and can actually be done quite efficiently. Generally a win.

Insert Entry <B, ptr>

™ Start at root and go down to “best-fit” leaf L.

ƒ Go to child whose box needs least enlargement to cover B; resolve ties by going to smallest area child.

™ If best-fit leaf L has space, insert entry and

stop. Otherwise, split L into L1 and L2.

ƒ Adjust entry for L in its parent so that the box now covers (only) L1. ƒ Add an entry (in the parent node of L) for L2. (This could cause the parent node to recursively split.)

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 19

Indexing High-Dimensional Data

™ Typically, high-dimensional datasets are collections of points, not regions. ƒ E.g., Feature vectors in multimedia applications. ƒ Very sparse ™ Nearest neighbor queries are common. ƒ R-tree becomes worse than sequential scan for most datasets with more than a dozen dimensions. ™ As dimensionality increases contrast (ratio of distances between nearest and farthest points) usually decreases; “nearest neighbor” is not meaningful. ƒ In any given data set, advisable to empirically test contrast.

Database management Systems, 3ed, R. Ramakrishnan and J. Gehrke 20

Summary

™ Spatial data management has many

applications, including GIS, CAD/CAM,

multimedia indexing.

ƒ Point and region data ƒ Overlap/containment and nearest-neighbor queries

™ Many approaches to indexing spatial data

ƒ R-tree approach is widely used in GIS systems ƒ Other approaches include Grid Files, Quad trees, and techniques based on “space-filling” curves. ƒ For high-dimensional datasets, unless data has good “contrast”, nearest-neighbor may not be well- separated

Comments on R-Trees

™ Deletion consists of searching for the entry to

be deleted, removing it, and if the node

becomes under-full, deleting the node and

then re-inserting the remaining entries.

™ Overall, works quite well for 2 and 3 D

datasets. Several variants (notably, R+ and R*

trees) have been proposed; widely used.

™ Can improve search performance by using a

convex polygon to approximate query shape

(instead of a bounding box) and testing for

polygon-box intersection.