1 / 18

Spatial Databases

Spatial Databases. Reading: None. In this lecture you will learn. the need for spatial databases some of the special issues regarding spatial data some of the issues concerning spatial database query languages some of the techniques used in spatial databases.

maxim
Download Presentation

Spatial Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Spatial Databases Reading: None

  2. In this lecture you will learn • the need for spatial databases • some of the special issues regarding spatial data • some of the issues concerning spatial database query languages • some of the techniques used in spatial databases Dept. of Computing Science, University of Aberdeen

  3. Applications of Spatial Databases • Spatial databases are used to store & manipulate data concerning: • Geography (2D) - maps, socio-economic, military • Engineering (2D/3D) - architectural drawings, CAD • Geophysics (3D) - geological strata, oil fields, mining • Here, we will focus on Geographic Information Systems (GIS). • These usually: • combine 2D spatial & textual data • have a graphical front-end • have an extended query language Dept. of Computing Science, University of Aberdeen

  4. Special IssuesWith Spatial Databases • Spatial objects: • have geometric shape, size, location (i.e. coordinate) • might change with time - e.g. land-use, urban areas • Issues: • Representation - how to represent e.g. a lake or a hill? • Query Languages - how to specify spatial queries? • e.g. find all lakes near mountains (a spatial join) • Indexing - how to accelerate spatial access methods • Data Collection - digitise satellite images, paper maps Dept. of Computing Science, University of Aberdeen

  5. Conceptual Modellingfor Spatial Databases • Conceptual modelling for spatial databases is similar to E-R modelling: • But there are some important differences: 0..* Has 1..1 Country Lake Dept. of Computing Science, University of Aberdeen

  6. Logical Modelling - Using Relational Model Country Boundary Point Contour Dept. of Computing Science, University of Aberdeen

  7. Query - Example • Return the contours of France • An SQL Query: Select Boundary.id-controur,x,y From Country,Boundary,Contour,Point Where name = ‘France And Country.id-boundary=Boundary.id-boundary And Boundary.id-contour=Contour.id-contour And Contour.id-point=Point.id-point Order by Boundary.id-contour,point-num; • Several problems as seen next Dept. of Computing Science, University of Aberdeen

  8. Problems with using RDBMS for Spatial Data • Formulating queries requires knowledge of the spatial object’s structure • New queries with change in structure • Bad performance • More space used and more cost in computing joins • User unfriendly • Manipulating points is not easy • Difficulty n defining new spatial types • Impossible to express geometric computations • Adjacency test, point query or window query Dept. of Computing Science, University of Aberdeen

  9. Abstract Data Types for Spatial Data • Clearly, we need some Abstract Data Types (ADTs) and associated method functions for spatial data, e.g.: • Point - Coordinates • Line - Coordinates, Length • Polygon - Coordinates, Perimeter, Area • Higher-order ADTs can be built from these basic types, e.g.: • Arc - a connected line list (start/end pts special) • Region - a set of non-overlapping polygons Dept. of Computing Science, University of Aberdeen

  10. Geometric Method Functions • Most GISs provide high-level method functions for geometric objects, e.g.: • Boolean  Inside(Point, Polygon) • Boolean  Crosses(Line, Polygon) • Boolean  Overlaps(Region, Region) • Region  Union(Region, Region) • Region  Intersect(Region, Region) • Region  Clip(Region, Polygon) • We will not be concerned with how these are implemented! Dept. of Computing Science, University of Aberdeen

  11. Types of Spatial Query • What kinds of spatial query should spatial databases support ? Here are a few: • Point - select all objects whose geometry contains a given point • Window - select all objects within a given rectangle • Join - select all pairs of objects that satisfy a given • relationship - overlap, containment, adjacency... Dept. of Computing Science, University of Aberdeen

  12. Desirable Featuresfor GIS Query Languages • What features should a spatial database query language have ? • Extensible - build complex objects from simpler ADTs • Programmable - supports user-defined functions • Reusable Methods - Weak typing (ADO) or object inheritance (Java) • Easy to learn - ? • Looks like SQL - ?? • Which of the above do SQL satisfy ? Dept. of Computing Science, University of Aberdeen

  13. Existing Spatial Query Languages • Different groups have attempted to extend SQL to handle geometric objects: • OQL - Object Query Language (Object Database Management Group) • SDO - Spatial Database Option (Oracle Corp.) • PostgreSQL - open source • Example: find all lakes (!) in Scotland (in the style of OQL): SELECT * FROM L in Lakes WHERE EXISTS (intersect(L.region, (SELECT C.polygon FROM C in Countries WHERE C.name = 'Scotland'))); Dept. of Computing Science, University of Aberdeen

  14. An Idealised Query Language • Lets invent a new query language (based on functional programming): map = null; b = border(Countries, "Scotland"); for each l in Lakes() { s = intersect(l, b); if (exists(s)) { map = union(map, s); } } • Which do you prefer - SQL or functional programming? • Real functional query languages exist, but mostly as research tools... Dept. of Computing Science, University of Aberdeen

  15. Spatial Indexes • Spatial DBs use a variety of techniques to accelerate spatial queries: • Bounding Boxes - simplify geometry tests: e.g. overlap • Grid Indexes - partition space • R-Trees - partition objects (R-Trees are like B-Tree with rectangular objects) • Ideally, objects close together in space should be: • Close together in index; preferably on same index page • Fundamental idea for indexing is to use approximations Dept. of Computing Science, University of Aberdeen

  16. Bounding Box Spatial Indexes • Rectangular boxes allow fast geometric filters to be applied - e.g. overlap • Then, evaluate objects that pass filter using actual geometries • However, every query requires a scan of the entire bounding box index Dept. of Computing Science, University of Aberdeen

  17. Grid Indexes - Partitioning Space • Divide space into a grid (the index): • Simple, fast - provided grid fits into memory • Works well if objects fit into grid cells... Dept. of Computing Science, University of Aberdeen

  18. Summary • Spatial DBs are useful for a wide range of applications... • Special issues: • I/O - data collection (input) graphical displays (output) • need for abstract geometric data types and functions • need for special indexing techniques (R-trees) • should existing SQL systems be adapted for geometric objects ? • Overall: • spatial DBs aren't (shouldn't be) so different from conventional DBs Dept. of Computing Science, University of Aberdeen

More Related