Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Spatial Databases

Similar presentations


Presentation on theme: "Introduction to Spatial Databases"— Presentation transcript:

1 Introduction to Spatial Databases
Assist. Prof. Dr. Ahmet Sayar Computer Engineering Department Advanced Database Applications Kocaeli University Spring 2013

2 What is a SDBMS ? A SDBMS is a software module that
can work with an underlying DBMS supports spatial data models, spatial abstract data types (ADTs) and a query language from which these ADTs are callable supports spatial indexing, efficient algorithms for processing spatial operations, and domain specific rules for query optimization GIS, SPATIAL DB VE DATABASE ILISKISI NE? Gis is the principle technology motivating interest in SDBMS. A GIS provides a rich set of operations over few object and layers, whereas an SDBMS provides simpler operations on a set of objects and sets of layers. SDB sits in traditional DB.

3 Why Spatial Databases GIS is the principle technology motivating interest in SDBMS. GIS is not the only area using SDBMS Many important application domains have spatial data and queries. Some Examples Insurance Risk Manager: Which homes are most likely to be affected in the next great flood on the Brisbane river? Molecular Biologist: Is the topology of the amino acid biosynthesis gene in the genome found in any other sequence feature map in the database ? Medical Doctor: Based on this patient's MRI, have we treated somebody with a similar condition ?

4 What is a Spatial Database?
A spatial database is a database system (DBMS) that is optimized to store and query basic spatial objects : Point: a house, a moving car, a city Line/Polyline: river, cable, road Polygon: a county, forest, lake, city And some more – see the nest slide

5 Spatial Object Types in OGIS Data Model
Each rectangle shows a distinct spatial object type 2-dim geometry Collection of islands Collection of oil wells

6 Spatial Data Examples Examples of non-spatial data
Names, phone numbers, addresses of people Examples of Spatial data NASA satellites imagery - terabytes of data per day Weather and Climate Data Rivers, Farms, ecological impact Medical Imaging Exercise: Identify spatial and non-spatial data items in A phone book A cookbook with recipes

7 Spatial and Non-Spatial Queries
List the names of all bookstore with more than ten thousand titles. List the names of ten customers, in terms of sales, in the year 2001 Where is Building 78? Which courses are meeting in GP Building? Spatial Queries: List the names of all bookstores with ten miles of Minneapolis List all customers who live in Tennessee and its adjoining states Which buildings are adjacent to the lake? Which building is adjacent to a lake? A majority of the DBMS in existence today are either incapable of managing spatial data or are not user-friendly when doing so.

8 Spatial Query Example -1
Spatial query language Spatial data types, e.g. point, linestring, polygon, … Spatial operations, e.g. overlap, distance, nearest neighbor, … Callable from a query language (e.g. SQL3) of underlying DBMS SELECT S.name FROM Senator S WHERE S.district.Area() > 300 Standards SQL3 (a.k.a. SQL 1999) is a standard for query languages OGC is a standard for spatial data types and operators Both standards enjoy wide support in industry Spatial query mantigina uyarlamak icin su anki SQL (SQL2) extend edilmeli. Bu genel istek standart bodyler tarafindan ele alindi ve SQL3 diye sql:1999 yeni bir yapi gelistirildi. SQL3 provides support for ADTs and other data structures. It gives the freedom to customize their implementations.

9 Spatial Query Example -2
“Display all countries that border Turkiye”. This query can be implemented using the following SQL command: select c1.name as name,transform(c1.the_geom,4326) as the_geom from county c1,county c2 Where touches(c1.the_geom,c2.the_geom) And c2.name=‘Turkiye';

10 Result 2 Algorithms for GIS: Intersection of lines, operations on polygons, network traversal, auto-correlation, statistical operations, searching. We focus on the use of algorithms, not their design. The actual algorithms are provided as database extensions (e.g. PostGIS) or desktop GIS (e.g. OpenJump or uDig)

11 Spatial Query Example -3
Query: For all the rivers listed in the River table, find the counties through which they pass. SELECT r.name, r.name FROM river AS r, county AS c WHERE crosses(r.the_geom,c.the_geom)=True The spatial predicate “Cross” is used to join River and Country tables To view this we would add asbinary(R.the_geom,C.the_geom) A spatial join associates two tables based on a spatial relationship, rather than an the classic non-spatial relational attribute. A spatial join operation is used to combine two or more dataset with respect to a spatial predicate or spatial operation. Predicates can be a combination of directional, distance, and topological spatial relations (e.g. overlap, contains). In case of non-spatial join, the joining attributes must of the same type, but for spatial join they can be of different types.

12 Spatial Query Example -4
A spatial join associate two tables based on a spatial relationship, rather than an attribute relationship. For example the query: Summarize the provincial election results by municipality. SELECT m.name, sum(v.ndp) AS ndp, sum(v.lib) AS liberal, sum(v.gp) AS green, sum(v.upbc) AS unity, sum(v.vtotal) AS total FROM bc_voting_areas v, bc_municipality m, WHERE intersects(v.the_geom, m.the_geom) GROUP BY m.name ORDER BY m.name; Note the && speeds up the join by using PostgreSQL’s native indexing on the geometry elements. v. So we could add the following to the where clause. the_geom && m.the_geom

13 Spatial Query Example -5
Spatial join example SELECT S.name FROM Senator S, Business B WHERE S.district.Area() > 300 AND Within(B.location, S.district) Non-Spatial Join example SELECT S.name FROM Senator S, Business B WHERE S.soc-sec = B.soc-sec AND S.gender = ‘Female’

14 SDBMS vs GIS ? GIS is a software to visualize and analyze spatial data using spatial analysis functions such as Search Thematic search, search by region, (re-)classification Location analysis Buffer, corridor, overlay Terrain analysis Slope/aspect, catchment, drainage network Flow analysis Connectivity, shortest path Distribution Change detection, proximity, nearest neighbor Spatial analysis/Statistics Pattern, centrality, autocorrelation, indices of similarity, topology: hole description Measurements Distance, perimeter, shape, adjacency, direction GIS uses SDBMS to store, search, query, share large spatial data sets

15 SDBMS vs GIS ? SDBMS focuses on
Efficient storage, querying, sharing of large spatial datasets Provides simpler set based query operations Example operations: search by region, overlay, nearest neighbor, distance, adjacency, perimeter etc. Uses spatial indices and query optimization to speedup queries over large spatial datasets. SDBMS may be used by applications other than GIS Astronomy, Genomics, Multimedia information systems, …

16 Components of a SDBMS Recall: a SDBMS is a software module that
can work with an underlying DBMS supports spatial data models, spatial ADTs and a query language from which these ADTs are callable supports spatial indexing, algorithms for processing spatial operations, and domain specific rules for query optimization Components include spatial data model, query language, query processing, file organization and indices, query optimization, etc.

17 Three Layer Architecture
Three-layer architecture to build a SDBMS on top of ORDBMS MMIS: Multimedia Information System CAD: Computer-aided design

18 SDBMS Example Consider a spatial dataset with:
County boundary (dashed white line) Census block - name, area, population, boundary (dark line) Water bodies (dark polygons) Satellite Imagery (gray scale pixels) Storage in a SDBMS table: create table census_blocks ( name string, area float, population number, boundary polyline); What is the problem here? Unfortunately, such a table is not natural for a traditional relational database because polyline is not a built-in data type.

19 Modeling Spatial Data in Traditional DBMS
A row in the table census_blocks Question: Is Polyline datatype supported in DBMS? Hint: 1. Create a collection of tables with overlapping attributes or 2. use “stored procedures”

20 Mapping “census_table” into a Relational Database


Download ppt "Introduction to Spatial Databases"

Similar presentations


Ads by Google