Spot db consistency checking and optimization in spatial database


Published on

SPOT databases: Spatial PrObablistic Temporal Databases

Published in: Education, Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Spot db consistency checking and optimization in spatial database

  2. 2. Agenda  Introduction  Optimization  Spatial Indexes  Spatial Query  SQL examples  Features of Spatial Databases  Advantages of Spatial Databases  Disadvantages of Spatial Databases  Conclusion
  3. 3. Introduction  Spatial database: is a database that is optimized to store and query data that represents objects defined in a geometric space  It offers additional functions that allow processing spatial data types.  Geometry.  Geography.
  4. 4. Introduction Cont.  Spatial Objects: Consists of lines, surfaces, volumes and higher dimension objects that are used in applications of computer-aided design, cartography, geographic information systems.  Spatial Data: The values of the objects spatial attributes (length, configuration, perimeter, area, volume, etc.)
  5. 5. Spatial DB Image
  6. 6. Optimization:  Optimizing spatial databases means optimizing the queries, which requires less time spent by running the queries before receiving an answer.
  7. 7. Spatial Indexes  Indexing Spatial Data: a mechanism to decrease the number of searches (optimize spatial queries).  A Spatial Index is used to locate objects in the same area of data or from different locations  Spatial indexes include:  Grid index  Z-order  Octree  Quadtree  UB-tree  R-tree  kd-tree  M-tree
  8. 8. Spatial Indexes: Grid Index In the context of a Spatial Index, a grid (a.k.a. "mesh", also "global grid" if it covers the entire surface of the globe) is a regular division of a 2-D surface that divides it into a series of contiguous cells, which can then be assigned unique identifiers and used for spatial indexing purposes.
  9. 9. Spatial Indexes: Z-Order  In mathematical analysis and computer science, Z-order, Morton order, or Morton code is a function which maps multidimensional data to one dimension while preserving locality of the data points.
  10. 10. Spatial Indexes: Octree An octree is a tree data structure in which each internal node has exactly eight childern. Octrees are most often used to partition a three dimensional space by recursively subdividing it into eight octants
  11. 11. Spatial Indexes: Quad Tree  A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.
  12. 12. Spatial Indexes: UB Tree  The UB-tree as proposed by Rudolf Bayer and Volker Markl is a balanced tree for storing and efficiently retrieving multidimensional data. It is basically a B+tree (information only in the leaves) with records stored according to z-order, also called Morton order. Z-order is simply calculated by bitwise interlacing the keys.
  13. 13. Spatial Indexes: R Tree  R-trees are tree data structure used for spatial access methods,i.e., for indexing multi- dimensional information such as geographical coordinates, rectangles or polygons.
  14. 14. Spatial Indexes: KD Tree  The k-d tree is a binary tree in which every node is a k-dimensional point. Every non-leaf node can be thought of as implicitly generating a splitting hyperlane that divides the space into two parts,
  15. 15. Spatial Indexes: M Tree  M-trees are tree data structure that are similar to R-trees and B-trees. As in any Tree-based data structure, the M-Tree is composed of Nodes and Leaves. In each node there is a data object that identifies it uniquely and a pointer to a sub-tree where its children reside. Every leaf has several
  16. 16. Spatial Query  A spatial query is a special type of database query supported by geo databases and spatial databases  Some of the most important are that they allow for the use of geometry data types such as points, lines and polygons and that these queries consider the spatial relationship between these geometries.
  17. 17. SQL example  Create “pubs” table create table pubs (name varchar, beer-price float4); addgeometrycolumn(‘beer-db’,'pubs','location’ ,2167,'POINT',3);
  18. 18. Insert data insert into pubs values ('Garricks Head',4.50, GeometryFromText('POINT (1196131 383324)’,2167));
  19. 19. Perform Query  select name, beer-price, distance(location, GeometryFromText('POINT(1195722 383854)',2167)) from pubs order by beer-price;  name | beer-price | distance  ---------------+------------+------------------  Fireside | 4.25 | 1484.10275160491  The Forge | 4.33 | 1533.06561109862  Rumours | 4.46 | 2042.00094093097  Garricks Head | 4.5 | 669.389105609889  Slap Happy | 4.5 | 1882.31910168298  Old Bailys | 4.55 | 1147.20900404641  Black Sheep | 4.66 | 536.859935972633  Big Bad Daves | 4.75 | 907.446543878884
  20. 20. Features of spatial databases  Spatial Measurements: Computes line length, polygon area, the distance between geometries, etc.  Spatial Functions: Modify existing features to create new ones, for example by providing a buffer around them, intersecting features, etc.  Spatial Predicates: Allows true/false queries about spatial relationships between geometries. Examples include "do two polygons overlap" or 'is there a residence located within a mile of the area we are planning to build the landfill?'  Geometry Constructors: Creates new geometries, usually by specifying the vertices (points or nodes) which define the shape.  Observer Functions: Queries which return specific information about a feature such as the location of the center of a circle
  21. 21. Advantages of Spatial Databases Able to treat your spatial data like anything else in the DB  transactions  backups  integrity checks  less data redundancy  fundamental organization and operations handled by the DB  multi-user support  security/access control  locking
  22. 22. Advantages cont. Spatial querying using SQL  use simple SQL expressions to determine spatial relationships  distance  adjacency  containment  use simple SQL expressions to perform spatial operations  area  length  intersection  union  buffer
  23. 23. Disadvantages of Spatial Databases  Cost to implement can be high  Some inflexibility  Incompatibilities with some GIS software  Slower than local, specialized data structures  User/managerial inexperience and caution
  24. 24. Conclusion  Spatial Databases are widely used nowadays.  Optimizing Spatial Databases is of a significant importance.  Spatial databases can be optimized using spatial indexes like R-tree or Quadtree and other indexing structures.  Big career opportunities in Spatial DB sector in developing GIS software