Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spatial Information Systems (SIS) COMP 30110 Spatial access methods: Indexing.

Similar presentations


Presentation on theme: "Spatial Information Systems (SIS) COMP 30110 Spatial access methods: Indexing."— Presentation transcript:

1 Spatial Information Systems (SIS) COMP 30110 Spatial access methods: Indexing

2 In previous lectures Oracle SpatialOracle Spatial Object-relational modelObject-relational model SDO_Geometry data typeSDO_Geometry data type Spatial functionality and Query modelSpatial functionality and Query model Today Indexing Spatial DataIndexing Spatial Data Indexing mechanisms in Oracle SpatialIndexing mechanisms in Oracle Spatial R-treesR-trees

3 Spatial Indexes Used to speed up spatial queries Example: Point query: return the geometric object that contains a given query point Sequentially scanning all objects of a large collection to check whether they contain the query point involves a high number of disk accesses and the repetition of the evaluation of computationally expensive geometric predicates (e.g., containment, intersection, etc.) Reducing the set of objects to be processed is highly desirable

4 Indexes for object-based and space-based representations Indexes for raster data: based on recursive subdivision of the space Example: quadtrees Indexes for vector data: differ depending on the type of data (extensions of quadtrees are used also for vector data)

5 Vector Data Indexing Different indexing methods are used for point, linear and polygonal dataDifferent indexing methods are used for point, linear and polygonal data In the case of collections of polygons, instead of indexing the object geometries themselves, whose shapes might be complex, we consider an approximation of the geometry and index it insteadIn the case of collections of polygons, instead of indexing the object geometries themselves, whose shapes might be complex, we consider an approximation of the geometry and index it instead Most commonly used approximation: minimum bounding rectangle (MBR) also called minimum bounding box (MBB)Most commonly used approximation: minimum bounding rectangle (MBR) also called minimum bounding box (MBB)

6 MBRs By using the MBR as the geometric key for building the spatial index, we save the cost of evaluating expensive geometric predicates during index traversal (as geometric tests againsts an MBR is constant)By using the MBR as the geometric key for building the spatial index, we save the cost of evaluating expensive geometric predicates during index traversal (as geometric tests againsts an MBR is constant) Example: point-in-polygon testExample: point-in-polygon test In addition, the space required to store a rectangle is constant (2 points)In addition, the space required to store a rectangle is constant (2 points) (x,y)

7 MBRs (cont.d) An operation involving a spatial predicate on a collection of objects indexed on their MBRs is performed in two steps: 1.Filter step: selects the objects whose MBR satisfies the spatial predicate (by traversing the spatial index and applying the predicate to the MBRs) 2.Refinement step: the objects that pass the filter step are a superset of the solution. An MBR might satisfy the predicate but the corresponding object might not obj MBR P

8 Refinement step: the objects that pass the filter step are a superset of the solution. An MBR might satisfy the predicate but the corresponding object might not Therefore, in this step the spatial predicate is applied to the actual geometry of the object obj MBR P Refinement step

9 Oracle Spatial Query Model Spatial Layer Data Table where coordinates are stored Primary Filter Spatial Index Index retrieves area of interest Reduced Data Set Secondary Filter Spatial Functions Procedures that determine exact relationship Exact Result Set

10 Oracle Spatial Indexing Methods Two types of indexes are implemented in Oracle Spatial: R-trees R-trees Quadtrees Quadtrees

11 R-trees Based on MBRs (minimum bounding rectangles) Defined for indexing 2D objects (can be extended to higher dimensions but implemented only for 2D in Oracle Spatial) MBRs of geometric objects form the leaves of the index tree Multiple MBRs are grouped into larger rectangles (MBRs) to form intermediate nodes in the tree Repeat until one rectangle is left that contains everything

12 R-trees a b c d abcd R S RS root R-tree 1 23 4 5 6 7 8 9 Pointers to geometries 4 56789 12 3

13 Remark: nodes Intermediate nodes store: Intermediate nodes store:  MBRs of collections of objects Leaf nodes store: Leaf nodes store:  MBRs of individual objects  Pointers to storage location of the exact geometry

14 Building R-trees An R-tree is a depth-balanced tree in which each node corresponds to a disk page (i.e., the number of entries in each node is limited) The structure satisfies the following properties: 1.For all nodes in the tree (except the root) the number of entries is between m and M 2.The root has at least two children (unless it is a leaf) 3.All leaves are at the same level

15 Example (1) a b c d abcd R S RS root R-tree 1 23 4 5 6 7 8 9 Pointers to geometries 4 56789 12 3 m = 2; M = 3

16 Example (2) m = 2; M = 4 R-tree R1R1 R3 root R2R2 …..

17 Searching R-trees We consider two types of queries: 1.point query: “what object contains the query point” 2.window query: “what objects intersect the query window”

18 Basic spatial queries (1) Containment Query: Given a spatial object O, find all objects in the collection that completely contain O. When O is a point, the query is called Point Query O P Containment Query Point Query (also Point-in-polygon, or Point Location)

19 Basic spatial queries (2) Region Query: Given a region R, find all objects in the collection that intersect R. When R is a rectangle, the query is called Window Query R R Region Query Window Query

20 Searching R-trees: window query  Compare search window with MBRs stored at each node  starting at root node  Stop at leaf nodes  compare contained geometries with search window

21 5 Searching R-trees: window query Example: abcdRSroot R-tree 1 23 4 6 7 8 9 4 89 12 3 a b c d root R S Pointers to geometries

22 Example: remarks If no MBRs are used: check the query window against all geometries for intersection (computationally expensive) In some cases, using R-trees to structure the set of MBRs can cause more tests (against MBRs) to be done. In general, this is not the case

23 Searching R-trees: point query Test query point for inclusion in MBRs stored at each node  starting at root node  Stop at leaf nodes  Test query point for inclusion in exact geometries

24 Exercise: point query a b c d abcd R S RS root R-tree 1 23 4 5 6 7 8 9 Pointers to geometries 4 56789 12 3 P

25 5 Searching R-trees: point query Example: abRSroot R-tree 1 23 4 6 7 8 9 4 3 a b root R S Pointers to geometries P

26 Summary Indexing Vector Spatial DataIndexing Vector Spatial Data R-trees:R-trees: Based on MBRs (leaves)Based on MBRs (leaves) Root: whole datasetRoot: whole dataset Intermediate nodes: groups of MBRs (objects) – not a partition of the underlying space!Intermediate nodes: groups of MBRs (objects) – not a partition of the underlying space!

27 Important remarks Note that the MBRs (at all levels) can overlapNote that the MBRs (at all levels) can overlap A rectangle is stored as child of a bigger rectangle only if completely contained in itA rectangle is stored as child of a bigger rectangle only if completely contained in itExample: Next lecture: Quadtrees for vector data (seen for raster)


Download ppt "Spatial Information Systems (SIS) COMP 30110 Spatial access methods: Indexing."

Similar presentations


Ads by Google