Spatial Queries. R-tree: variations What about static datasets? (no ins/del) Hilbert What about other bounding shapes?

Slides:



Advertisements
Similar presentations
1 Spatial Join. 2 Papers to Present “Efficient Processing of Spatial Joins using R-trees”, T. Brinkhoff, H-P Kriegel and B. Seeger, Proc. SIGMOD, 1993.
Advertisements

Spatio-temporal Databases
Spatial Indexing SAMs. Spatial Indexing Point Access Methods can index only points. What about regions? Z-ordering and quadtrees Use the transformation.
Spatial and Temporal Data Mining V. Megalooikonomou Spatial Access Methods (SAMs) II (some slides are based on notes by C. Faloutsos)
Spatial Join Queries. Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries.
On Spatial-Range Closest Pair Query Jing Shan, Donghui Zhang and Betty Salzberg College of Computer and Information Science Northeastern University.
Nearest Neighbor Queries using R-trees
Nearest Neighbor Queries using R-trees Based on notes from G. Kollios.
A Simple and Efficient Algorithm for R-Tree Packing Scott T. Leutenegger, Mario A. Lopez, Jeffrey Edgington STR Sunho Cho Jeonghun Ahn 1.
B+-Trees (PART 1) What is a B+ tree? Why B+ trees? Searching a B+ tree
CMU SCS : Multimedia Databases and Data Mining Lecture #6: Spatial Access Methods Part III: R-trees C. Faloutsos.
1 NNH: Improving Performance of Nearest- Neighbor Searches Using Histograms Liang Jin (UC Irvine) Nick Koudas (AT&T Labs Research) Chen Li (UC Irvine)
Efficient Reverse k-Nearest Neighbors Retrieval with Local kNN-Distance Estimation Mike Lin.
1 CSIS 7101: CSIS 7101: Spatial Data (Part 2) Efficient Processing of Spatial Joins Using R-trees Rollo Chan Chu Chung Man Mak Wai Yip Vivian Lee Eric.
2-dimensional indexing structure
Spatio-temporal Databases Time Parameterized Queries.
Spatial Indexing SAMs. Spatial Indexing Point Access Methods can index only points. What about regions? Z-ordering and quadtrees Use the transformation.
Spatial Access Methods Chapter 26 of book Read only 26.1, 26.2, 26.6 Dr Eamonn Keogh Computer Science & Engineering Department University of California.
Liang Jin (UC Irvine) Nick Koudas (AT&T) Chen Li (UC Irvine)
Spatial Indexing for NN retrieval
Spatial Indexing SAMs. Spatial Access Methods PAMs Grid File kd-tree based (LSD-, hB- trees) Z-ordering + B+-tree R-tree Variations: R*-tree, Hilbert.
Spatial Indexing SAMs.
Spatial Queries Nearest Neighbor and Join Queries.
Multi-dimensional Indexes
Lars Arge1, Mark de Berg2, Herman Haverkort3 and Ke Yi1
Nearest Neighbor Queries Sung-hsun Su April 12, 2001
1 R-Trees for Spatial Indexing Yanlei Diao UMass Amherst Feb 27, 2007 Some Slide Content Courtesy of J.M. Hellerstein.
Spatial Queries Nearest Neighbor Queries.
I/O-Algorithms Lars Arge Aarhus University March 6, 2007.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part B Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
Spatial Indexing SAMs. Spatial Access Methods PAMs Grid File kd-tree based (LSD-, hB- trees) Z-ordering + B+-tree R-tree Variations: R*-tree, Hilbert.
Spatial Indexing I Point Access Methods. Spatial Indexing Point Access Methods (PAMs) vs Spatial Access Methods (SAMs) PAM: index only point data Hierarchical.
Advanced Data Structures NTUA 2007 R-trees and Grid File.
Spatial Indexing I Point Access Methods. Spatial Indexing Point Access Methods (PAMs) vs Spatial Access Methods (SAMs) PAM: index only point data Hierarchical.
Spatial Indexing. Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries.
CMU SCS : Multimedia Databases and Data Mining Lecture #6: Spatial Access Methods Part III: R-trees C. Faloutsos.
Performance of Nearest Neighbor Queries in R-trees Apostolos Papadopoulos and Yannis Manolopoulos Presenter: Uma Kannan.
R-Trees Extension of B+-trees.  Collection of d-dimensional rectangles.  A point in d-dimensions is a trivial rectangle.
Spatial Data Management Chapter 28. Types of Spatial Data Point Data –Points in a multidimensional space E.g., Raster data such as satellite imagery,
Join-Queries between two Spatial Datasets Indexed by a Single R*-tree Join-Queries between two Spatial Datasets Indexed by a Single R*-tree Michael Vassilakopoulos.
SEMILARITY JOIN COP6731 Advanced Database Systems.
The X-Tree An Index Structure for High Dimensional Data Stefan Berchtold, Daniel A Keim, Hans Peter Kriegel Institute of Computer Science Munich, Germany.
Temple University – CIS Dept. CIS616– Principles of Data Management V. Megalooikonomou Spatial Access Methods (SAMs) ( based on notes by Silberchatz,Korth,
Advanced Data Structures NTUA 2007 R-trees and Grid File.
Nearest Neighbor Queries Chris Buzzerd, Dave Boerner, and Kevin Stewart.
Spatial Query Processing Spatial DBs do not have a set of operators that are considered to be basic elements in a query evaluation. Spatial DBs handle.
Bin Yao (Slides made available by Feifei Li) R-tree: Indexing Structure for Data in Multi- dimensional Space.
Lecture 3: External Memory Indexing Structures (Contd) CS6931 Database Seminar.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
R-Trees: A Dynamic Index Structure For Spatial Searching Antonin Guttman.
1 CSIS 7101: CSIS 7101: Spatial Data (Part 1) The R*-tree : An Efficient and Robust Access Method for Points and Rectangles Rollo Chan Chu Chung Man Mak.
23 1 Christian Böhm 1, Florian Krebs 2, and Hans-Peter Kriegel 2 1 University for Health Informatics and Technology, Innsbruck 2 University of Munich Optimal.
STR: A Simple and Efficient Algorithm for R-Tree Packing.
1 Reverse Nearest Neighbor Queries for Dynamic Databases SHOU Yu Tao Jan. 10 th, 2003 SIGMOD 2000.
Spatial Queries Nearest Neighbor and Join Queries Most slides are based on slides provided By Prof. Christos Faloutsos (CMU) and Prof. Dimitris Papadias.
1 Spatial Query Processing using the R-tree Donghui Zhang CCIS, Northeastern University Feb 8, 2005.
1 R-Trees Guttman. 2 Introduction Range queries in multiple dimensions: Computer Aided Design (CAD) Geo-data applications Support special data objects.
Spatial Data Management
Strategies for Spatial Joins
Many slides taken from George Kollios, Boston University
Spatial Queries Nearest Neighbor and Join Queries.
KD Tree A binary search tree where every node is a
Nearest Neighbor Queries using R-trees
R-tree: Indexing Structure for Data in Multi-dimensional Space
Spatio-temporal Databases
15-826: Multimedia Databases and Data Mining
Spatial Indexing I R-trees
Spatio-temporal Databases
C. Faloutsos Spatial Access Methods - R-trees
Presentation transcript:

Spatial Queries

R-tree: variations What about static datasets? (no ins/del) Hilbert What about other bounding shapes?

R-trees - variations what about static datasets (no ins/del/upd)? Q: Best way to pack points?

R-trees - variations what about static datasets (no ins/del/upd)? Q: Best way to pack points? A1: plane-sweep great for queries on ‘x’; terrible for ‘y’

R-trees - variations what about static datasets (no ins/del/upd)? Q: Best way to pack points? A1: plane-sweep great for queries on ‘x’; bad for ‘y’

R-trees - variations what about static datasets (no ins/del/upd)? Q: Best way to pack points? A1: plane-sweep great for queries on ‘x’; terrible for ‘y’ Q: how to improve?

R-trees - variations A: plane-sweep on HILBERT curve!

R-trees - variations A: plane-sweep on HILBERT curve! In fact, it can be made dynamic (how?), as well as to handle regions (how?)

R-trees - variations Dynamic (‘Hilbert R- tree): each point has an ‘h’- value (hilbert value) insertions: like a B-tree on the h-value but also store MBR, for searches

Hilbert R-tree Data structure of a node? LHV x-low, ylow x-high, y-high ptr h-value >= LHV & MBRs: inside parent MBR

R-trees - variations Data structure of a node? LHV x-low, ylow x-high, y-high ptr h-value >= LHV & MBRs: inside parent MBR ~B-tree

R-trees - variations Data structure of a node? LHV x-low, ylow x-high, y-high ptr h-value >= LHV & MBRs: inside parent MBR ~ R-tree

R-trees - variations What if we have regions, instead of points? I.e., how to impose a linear ordering (‘h- value’) on rectangles?

R-trees - variations What if we have regions, instead of points? I.e., how to impose a linear ordering (‘h-value’) on rectangles? A1: h-value of center A2: h-value of 4-d point (center, x-radius, y-radius) A3:...

R-trees - variations What if we have regions, instead of points? I.e., how to impose a linear ordering (‘h-value’) on rectangles? A1: h-value of center A2: h-value of 4-d point (center, x-radius, y-radius) A3:...

R-trees - variations with h-values, we can have deferred splits, 2-to-3 splits (3-to-4, etc) Instead of splitting a full node, find the siblings (using the h-values) and redistribute the rectangles among the nodes. Split only when all siblings are full. experimentally: faster than R*-trees (reference: [Kamel Faloutsos vldb 94])

R-trees - variations what about other bounding shapes? (and why?) A1: arbitrary-orientation lines (cell-tree, [Guenther] A2: P-trees (polygon trees) (MB polygon: 0, 90, 45, 135 degree lines)

R-trees - variations A3: L-shapes; holes (hB-tree) A4: TV-trees [Lin+, VLDB-Journal 1994] A5: SR-trees [Katayama+, SIGMOD97] (used in Informedia)

R-trees - conclusions Popular method; like multi-d B-trees guaranteed utilization good search times (for low-dim. at least) Informix ships DataBlade with R-trees

Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries range queries k-nn queries spatial joins (‘all pairs’ queries)

Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries range queries k-nn queries spatial joins (‘all pairs’ queries)

Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries range queries k-nn queries spatial joins (‘all pairs’ queries)

Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries range queries k-nn queries spatial joins (‘all pairs’ queries)

Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries range queries k-nn queries spatial joins (‘all pairs’ queries)

R-trees - Range search pseudocode: check the root for each branch, if its MBR intersects the query rectangle apply range-search (or print out, if this is a leaf)

R-trees - NN search A B C D E F G H I J P1 P2 P3 P4 q

R-trees - NN search Q: How? (find near neighbor; refine...) A B C D E F G H I J P1 P2 P3 P4 q

R-trees - NN search A1: depth-first search; then, range query A B C D E F G H I J P1 P2 P3 P4 q

R-trees - NN search A1: depth-first search; then, range query A B C D E F G H I J P1 P2 P3 P4 q

R-trees - NN search A1: depth-first search; then, range query A B C D E F G H I J P1 P2 P3 P4 q

R-trees - NN search A2: [Roussopoulos+, sigmod95]: priority queue, with promising MBRs, and their best and worst-case distance main idea: Every face of any MBR contains at least one point of an actual spatial object!

R-trees - NN search A B C D E F G H I J P1 P2 P3 P4 q consider only P2 and P4, for illustration

R-trees - NN search D E H J P2 P4 q worst of P2 best of P4 => P4 is useless for 1-nn

R-trees - NN search D E P2 q worst of P2 what is really the worst of, say, P2?

R-trees - NN search P2 q what is really the worst of, say, P2? A: the smallest of the two red segments!

Nearest-neighbor searching Branch and bound strategy Compute MINDIST and MINMAXDIST [RKV95] MINDIST(p,R) is the minimum distance between p and R with corner points l and u the closest point in R is at least this distance away Sqrt sum (p i -r i ) 2 where r i = l i if p i < l i = u i if p i > u i = p i otherwise p p p R l u MINDIST = 0

Nearest-neighbor searching MINMAXDIST(p,R) is the minimum of the maximum distance to each pair of faces of R MaxDistanceToFace(p,R,k) = distance between p and Max k = (M 1,M 2,..,M k-1 m k,M K+1,..,M n ) m i = closer of the two boundary points along i axis M i = farther of the two boundary points along i axis l u p Max 1 Max 2

Nearest-neighbor searching MINMAXDIST(p,R) is the minimum of the maximum distance to each pair of faces of R MaxDistanceToFace(p,R,k) = distance between p and Max k = (M 1,M 2,..,M k-1 m k,M K+1,..,M n ) m i = closer of the two boundary points along i axis M i = farther of the two boundary points along i axis l u p Max 1 Max 2

Pruning ESTIMATE := smallest MINMAXDIST(p,R) Prune an MBR R’ for which MINDIST(p,R’) is greater than ESTIMATE. Generalize to k-nearest neighbor searching Maintain kth largest MINMAXDIST Prune an MBR if MINDIST to it is larger than the current estimate of kth MINMAXDIST Can use objects to refine estimate

Order of searching Depth first order Inspect children in MINDIST order For each node in the tree keep a list of nodes to be visited Prune some of these nodes in the list Continue until the lists are empty

Another NN search Global order [HS99] Maintain distance to all entries in a common list Order the list by MINDIST Repeat Inspect the next MBR in the list Add the children to the list and reorder Until all remaining MBRs can be pruned

Spatial Join Find all parks in a city Find all trails that go through a forest Basic operation find all pairs of objects that overlap Single-scan queries nearest neighbor queries, range queries Multiple-scan queries spatial join

Algorithms No existing index structures Transform data into 1-d space [O89] z-transform; sensitive to size of pixel Partition-based spatial-merge join [PW96] partition into tiles that can fit into memory plane sweep algorithm on tiles Spatial hash joins [LR96, KS97] Sort data [BBKK01] With index structures [BKS93, HJR97] k-d trees and grid files R-trees

R-tree based Join [BKS93] R S

Join1(R,S) Repeat Find a pair of intersecting entries E in R and F in S If R and S are leaf pages then add (E,F) to result-set Else Join1(E,F) Until all pairs are examined CPU and I/O bottleneck

Reducing CPU bottleneck R S

Join2(R,S,IntersectedVol) Repeat Find a pair of intersecting entries E in R and F in S that overlap with IntersectedVol If R and S are leaf pages then add (E,F) to result-set Else Join2(E,F,CommonEF) Until all pairs are examined 14+6 comparisons instead of 49 In general, number of comparisons equals size(R) + size(S) + relevant(R)*relevant(S) Reduce the product term

Using Plane Sweep R S Consider the extents along x-axis Start with the first entry r1 sweep a vertical line r1 r2 r3 s1 s2

Using Plane Sweep R S r1 r2 r3 s1 s2 Check if (r1,s1) intersect along y-dimension Add (r1,s1) to result set

Using Plane Sweep R S r1 r2 r3 s1 s2 Check if (r1,s2) intersect along y-dimension Add (r1,s2) to result set

Using Plane Sweep R S r1 r2 r3 s1 s2 Reached the end of r1 Start with next entry r2

Using Plane Sweep R S r1 r2 r3 s1 s2 Reposition sweep line

Using Plane Sweep R S r1 r2 r3 s1 s2 Check if r2 and s1 intersect along y Do not add (r2,s1) to result

Using Plane Sweep R S r1 r2 r3 s1 s2 Reached the end of r2 Start with next entry s1

Using Plane Sweep R S r1 r2 r3 s1 s2 Total of 2(r1) + 1(r2) + 0 (s1)+ 1(s2)+ 0(r3) = 4 comparisons

Reducing I/O Read schedule r1, s1, s2, r3 Every subtree examined only once Consider a slightly different layout

Reducing I/O R S r1 r2 r3 s1 s2 Read schedule is r1, s2, r2, s1, s2, r3 Subtree s2 is examined twice

Pinning of nodes After examining a pair (E,F), compute the degree of intersection of each entry degree(E) is the number of intersections between E and unprocessed rectangles of the other dataset If the degrees are non-zero, pin the pages of the entry with maximum degree Perform spatial joins for this page Continue with plane sweep

Reducing I/O R S r1 r2 r3 s1 s2 After computing join(r1,s2), degree(r1) = 0 degree(s2) = 1 So, examine s2 next Read schedule = r1, s2, r3, r2, s1 Subtree s2 examined only once

References [SK98] Optimal multi-step k-nearest neighbor search, T. Seidl and H. Kriegel, SIGMOD 1998: [BBKK01] Epsilon Grid Order: An Algorithm for the Similarity Join on Massive High-Dimensional Data, C. Bohm, B. Braunmüller, F. Krebs and H.-P. Kriegel, SIGMOD [RKV95] Roussopoulos N., Kelley S., Vincent F. Nearest Neighbor Queries. Proceedings of the ACM-SIGMOD International Conference on Management of Data, pages 71-79, 1995.

References [HS99] G. R. Hjaltason and H. Samet, Distance browsing in spatial databases, ACM Transactions on Database Systems 24, 2 (June 1999), Distance browsing in spatial databases [O89] Jack A. Orenstein: Redundancy in Spatial Databases. SIGMOD Conference 1989: [PW96] Jignesh M. Patel, David J. DeWitt: Partition Based Spatial-Merge Join. SIGMOD Conference 1996: [LR96] Ming-Ling Lo, Chinya V. Ravishankar: Spatial Hash-Joins. SIGMOD Conference 1996:

References [KS97] Nick Koudas, Kenneth C. Sevcik: Size Separation Spatial Join. SIGMOD Conference 1997: [HJR97] Yun-Wu Huang, Ning Jing, Elke A. Rundensteiner: Spatial Joins Using R-trees: Breadth-First Traversal with Global Optimizations. VLDB 1997, [BKS93] Thomas Brinkhoff, Hans-Peter Kriegel, Bernhard Seeger: Efficient Processing of Spatial Joins Using R-Trees. SIGMOD Conference 1993: