This action might not be possible to undo. Are you sure you want to continue?

# Snehal Thakkar Spatial Data Structures Hanan Samet Computer Science Department University of Maryland

Snehal Thakkar

1

**Spatial Data Structures
**

Introduction Spatial Indexing Region Data Point Data Rectangle Data Line Data Conclusion

Snehal Thakkar 2

Introduction

Spatial Objects

Points, Lines, Regions, Rectangles «..

Spatial Indexing

Unlike conventional data sort has to be on space occupied by data

** Hierarchical Data Structures
**

Based on recursive decomposition, similar to divide and conquer method

Snehal Thakkar 3

. BANG file.Same.Problems with queries like nearest Bucketing Methods . queries like intersect . Buddy trees«. LSD trees.Good storage purposes. but based on actual space.Grid file.Buckets based on not the representative point. Higher or Lower Dimension .Spatial Indexing Mapping Spatial Data into Point . Snehal Thakkar 4 .

R-tree Based on Minimum Bounding Rectangle R1 R3 a b R4 d g h R2 R5 c i R6 e f Snehal Thakkar 5 .

g.R4«« Snehal Thakkar 6 . Each node in the tree corresponds to smallest ddimensional rectangle that encloses child nodes. Tree parameters are adjusted so that small number of pages are visited during a spatial query All leaf nodes appear at same level Each leaf node is (R. If an object is spatially contained in several nodes.O) where R is smallest rectangle containing O. R3. e.R-Trees (Continued) Organize spatial objects into d-dimensional rectangles. it is only stored in one node.

R2 R-tree of order (m.g. rectangles depend on how objects are inserted and deleted from the tree. R1.P) where R is smallest rectangle containing all child rectangles. with exception of root node. R-tree is not unique.R-trees (Continued) Each non-leaf node is (R. Snehal Thakkar 7 .M) means that each node in the tree has between floor M/2 and M nodes. Problem is that to find some object you might have to go through several rectangles or whole database. Root node has two entries unless it is a leaf node. e.

+ R .Trees Decomposition of Space into Disjoint Cells R1 R3 d g h R4 c h i R2 R5 a b e i R6 c f i Snehal Thakkar 8 .

If object is in multiple rectangles. Try not to overlap the rectangles. it will appear multiple times. Snehal Thakkar 9 .+ R Trees (Continued) R+-tree and Cell Trees used approach of discomposing space into cells R+-trees deals with collection of objects bounded by rectangles Cell tree deals with collection of objects bounded by convex polyhedra R+-trees is extension of k-d-B-tree.

so depending on how you insert or delete records R+-tree will be different.+Trees(Continued) R Multiple paths to object from the root Height of the tree is increased Retrieval times are smaller When summing the objects. needs eliminate duplicates It is not possible to guarantee that all properties of Btrees is fulfilled without going through difficult insert and deletion routines. Snehal Thakkar 10 . It is data-dependent.

More data-independence then R+-trees . Snehal Thakkar 11 .More Spatial Indexing Uniform Grid .Width of the blocks is restricted to power of two .Higher overhead Quadtree .Ideal for uniformly distributed data .Space decomposed on blocks on uniform size . like composition of data.Sensitive to positioning of the object .Good for Set-theory type operations.Space is decomposed based on data points .

Blocks may overlap . row representation Metal Axis Transformation (MAT) .Break array into 1*m blocks.Union of Maximal Square blocks .Region Data Focus on Interior Representation Represented as Image array of pixels Runlength Code .Block are specified by center and radius Snehal Thakkar 12 .

To be at standard locations .To have standard sizes(squares whose sides are power of two) .Based on successive subdivision of image array into four equal size quadrants.More Region Data Region Quadtree .Whose blocks are required to be disjoint .Is Metal Axis Transformation . Snehal Thakkar 13 .

Region Quadtree 2 3 1 4 5 7 8 6 9 10 13 14 15 16 11 12 17 18 19 2 A NW NE SW SE 1 3 B 4 5 7 C 6 D 11 12 8 9 10 F 13 14 E 19 15 16 17 18 Snehal Thakkar 14 .

Region Quadtree (Continued) Each leaf node is either Black or White All non-leaf nodes are Gray(Circle is previous example You can also use it for non-binary images Resolution of the decomposition may be governed by data or predetermined Can be used for several object representations. Snehal Thakkar 15 .

search is continued in the neighborhood of the node containing object. .Adoption of Binary Search Tree to two dimensions or more .Feature based queries tough because index is based on spatial occupancy not on features.Quadtree with rectangular quadrants . .Useful for location based queries like where is nearest theatre from the location.Descending the tree till you find the node for location based queries. .Variations of Quadtree Point Quadtree . Snehal Thakkar 16 .For nearest neighbor.

Recursively subdivide into eight octants Snehal Thakkar 17 . .Useful for feature based queries like where does wheat grow in California.Variations of Quadtree Pyramid . each one quarter size of previous .Exponentially tapering stack of arrays.Nodes that are not at maximum level of resolution contain summary information Octree .Three dimensional analog of quadtree .

sequence of directional codes that locates leaf from the root .Treats image as a collection of leaf nodes. . each encoded by pair of numbers .First is base 4 number.Represents the image in form of traversal of nodes of its quadtree .Very Compact storage. each node type can be encoded with two bits.Not easy to use when random access to nodes is required.More Variations of Quadtree Locational Code Based Quadtree . Snehal Thakkar 18 .Second depth at which node is found or size DF-expression .

Searching with Quadtree Useful for performing set operations When performing intersection. it only returns black node when both quadtrees have black nodes. Worst case scenario is sum of nodes in two quadtrees Snehal Thakkar 19 . Operation is performed using three quadtrees.

Number of nodes in quadtree representation is O(p+q) for 2q*2q image with perimeter p measured in pixel width. .Algorithms with Quadtree Most algorithms are preorder traversals Execution time is linear function of number of nodes Quadtree Complexity Theorem .It also holds for more dimensions. Snehal Thakkar 20 .

Shape of the tree is independent of the order in which points are inserted .Point Data PR Quadtree .Organized same way as the region quadtree .A quadrant contains at most one data point .Can use quadrants with capacity c .Leaf nodes are either empty or contain data point and its co-ordinates .Good for search within specified distance of given record Snehal Thakkar 21 .If points are close together then decomposition can be deep .Regular decomposition of space into quadrants .

15) (92.65) (52.0) Snehal Thakkar 22 .100) (100.PR-tree (Continued) (50.25) (20.50) (75.88) (75.25) (0.1) (0.0) (100.75) (25.100) (88.

Rectangle Data Used to approximate other objects in the image and in VLSI design rule checking If environment is static. solution is based on use of plane sweep paradigm Any addition to database forces reexecution of algorithm on whole database Snehal Thakkar 23 .

Set of intervals is represented by Grid File .Each interval is represented by center and extent .Grid File uses two dimensional array of grid blocks called Grid Directory Snehal Thakkar 24 .Made up of Cartesian product of two one dimensional intervals .Rectangle Data (Continued) Grid File Based Approach .Each rectangle reduced to a point in higher dimension .

Grid Directory has address of the bucket .Set of linear scales is kept in the core to access grid block in the grid directory .First operation to access the grid block .Guarantees access to record in two operations .Rectangle Data (Continued) Grid File Based Approach (Continued) .Second operation to access the grid bucket Snehal Thakkar 25 .

Rectangles can be associated with terminal and non-terminal nodes Snehal Thakkar 26 .Decomposition of space into rectangles .Based on Quadtree .Each rectangle is associated with a quadtree node corresponding to the smallest block which contains it in its entirety .Subdivision stops when nodes block contains no rectangles or at predetermined size .Rectangle Data (Continued) MX-CIF Quadtree .

E} {G} {B.C.D} {F} Snehal Thakkar 27 .MX-CIF Quadtree B A D F G E C {A.

Useful because space requirements for polyhedral objects are smaller then conventional octree Snehal Thakkar 28 .Based on regular decomposition of space .Partitioning occurs as long as a block contains more than one line segment unless the line segments are incident at a vertex in the block .Vertex-based implementation .Line Data PM1 quadtree .

1 PM Quadtree(Continued) Snehal Thakkar 29 .

Edge-based variant of PM quatree .Line Data (Continued) PMR Quadtree .Uses probabilistic splitting rule .During deletion line segment is removed from all blocks and blocks are checked for merging Snehal Thakkar 30 .If block has more line segments than permitted. it is divided into four blocks once and only once .Each line segment is inserted into all blocks that it intersects or occupies .Block contains variable number of line segments .

PMR Quadtree Snehal Thakkar 31 .

PMR Quadtree Snehal Thakkar 32 .

PMR Quadtree Snehal Thakkar 33 .

edu Snehal Thakkar 34 .Conclusion Questions ? Comments ? Email me at snehalth@usc.