You are on page 1of 62

THE UNIVERSITY OF INFORMATION TECHNOLOGY

INFORMATION SYSTEM FACULTY

LEC: CAO THỊ KIM TUYẾN


Email: tuyenctk@uit.edu.vn
ctktuyengis2007@gmail.com
1
CONTENTS
1 INTRODUCTION TO SPATIAL DB

2 SPATIAL DATA MODELS

3 BUILDING A GEODATABASE

4 SPATIAL QUERY LANGUAGES

5 SPATIAL STORAGE AND INDEXING

6 QUERY PROCESSING, OPTIMIZATION

7 SPATIAL DATA MINING 2


I. INTRODUCTION TO SPATIAL DB

1. Learning Objectives
• Understand basic properties of spatial/geographic
data
• Understand the value of SDBMS
- Application domains
- Users
- How is different from a DBMS?
• Understand concept of spatial databases
• Learn about major spatial information applications
• Learn about components of Spatial Database Management
Systems (SDBMS)

Everything
Everything happens
happens somewhere,
somewhere, sometime
sometime 3
SPATIAL DATA

Spatial Data
• Data with an associated spatial
location (with respect to a given
reference frame).
• Information about the location and
shape of, and relationships among,
geographic features, usually stored as
4
coordinates and topology.
5
SPATIAL DATA
Reference Frame
Are basically the different perspectives of the viewer to
describe physical quantities (e.g., position, velocity) while the
coordinate systems are the different ways to describe physical
quantities in these perspectives.
Geographic / Geospatial Data
• Data whose underlying reference frame is the Earth’s
surface.
• Geospatial information concerns phenomena above, one and
below the Earth’s surface.
The notions “spatial data” and “geospatial data” are often
6
used interchangeably.
GEOSPATIAL DATA

7
A set of A spatial
alphanumeric SPATIAL
component:
DATA Geographic objects
attribute: can be atomic or
descriptive spatial object
complex
attributes
At the conceptual level,
a geographic object’’s component

Spatial data may be obtained from


– primary data collections:

Devices, GPS Docs


SCADA
– digitized from existing maps;

8
Your Interest in Spatial Databases
Jobs in GIS
• Government
– Most major departments are developing GIS on an ongoing
basis: e.g. the Geological Survey of Ireland (GSI),
Environment Protection Agency (EPA), Duchas, OPW.
• Semi-states
– Many agencies have a big investment in GIS e.g. ESB.
• Local Authorities
– County councils run many GIS applications.
• Private Sector
– MAPFLOW, IMGS (Information with location).
• Post graduate research
– DIT Digital Media Centre (DMC), The National Centre for
Geocomputation (Maynooth). 9
10
Your Interest in Spatial Databases
Technically Interesting
• Spatial databases provided the essential logic and structure for
a host useful and interesting applications (e.g. emergency
services routing, hospital placement, game environments).
• This spatial database course brings together many topics that
you have already studied (e.g. databases, graphics, objection
orientation, statistics) and applies them in innovative ways.
• Spatial databases can answer a range of questions from
“where is the nearest chipper?” to “How does Sellafield effect
the Irish east coast?”.
• Spatial database work with many other technologies (e.g.
11
Internet ,wireless networks, and GPS.)
What is a Spatial Database?
• A spatial database is a database system (DBMS) that is
optimized to store and query basic spatial objects e.g.:
• Point: a house, a moving car
• Line: a road segment, road network
• Polygon: a county, voting area
• Which are usually augmented with spatial relations,
thematic information, and temporal information, all
expressed in a declarative way using a appropriate
languages (e.g. SQL+spatial extensions).

12
Tables or layers of data

13
Roads are represented as Lines
Mail Boxes are represented as Points 14
Land Use Classifications are
represented as Polygons 15
Combination of all the previous data
16
17
DB IN SPATIAL CONTEXT
 Database – an integrated set of data on a particular
subject
 Spatial database - database containing geographic data
of a particular subject for a particular area
 DBMS – software to create, maintain and access
databases

18
1. Advantages, disadvantages of DB
over Files?
Characteristics of DBMS?

19
20
CHARACTERISTICS OF DBMS
 Data model support for multiple data types
e.g. MS Access: Text, Memo, Number, Date/Time,
Currency, AutoNumber, Yes/No, OLE Object,
 Hyperlink, Lookup Wizard
 Load data from files, databases and other applications
 Indexed for rapid retrieval
 Query language – SQL
=> Security – controlled access to data
 Multi-level groups
 Controlled update using a transaction manager
 Backup and recovery
21
RDBMS Consists of tables

22
Relational Database Example #1

23
MODELING SPATIAL DATA IN
TRADITIONAL DBMS
• A row in the table census_blocks (Figure 1.3)
• Question: Is Polyline datatype supported in DBMS?

24
Figure 1.3
Spatial Data Types and Traditional DB
• Traditional relational DBMS
– Support simple data types, e.g. number, strings, date
– Modeling Spatial data types is tedious
• Example: Figure 1.4 shows modeling of polygon using
numbers
– Three new tables: polygon, edge, points
• Note: Polygon is a polyline where last point and first
point are same
– A simple unit sqaure represented as 16 rows across 3 tables
– Simple spatial operators, e.g. area(), require joining tables
– Tedious and computationally inefficient

• Question. Name post-relational database management systems 25

which facilitate modeling of spatial data types, e.g. polygon.


Mapping “Census_table” Into A RDB

26
Fig 1.4
Evolution of DBMS technology

27
Fig 1.5
SPATIAL DATA TYPES AND
POST-RELATIONAL DB

• Post-relational DBMS
– Support user defined abstract data types
– Spatial data types (e.g. polygon) can be added
• Choice of post-relational DBMS
– Object oriented (OO) DBMS
– Object relational (OR) DBMS
• A spatial database is a collection of spatial data types,
operators, indices, processing strategies, etc. and can
work with many post-relational DBMS as well as
programming languages like Java, Visual Basic etc.
28
HOW IS A SDBMS DIFFERENT FROM A 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
29
HOW IS A SDBMS DIFFERENT FROM A GIS
• SDBMS focusses 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, ...
• Will one use a GIS or a SDBM to answer the following:
– How many neighboring countries does USA have?
– Which country has highest number of neighbors?
30
Evolution of acronym “GIS”
• Geographic Information Systems (1980s)
• Geographic Information Science (1990s)
• Geographic Information Services (2000s)

31
Fig 1.1
3 MEANINGS OF THE ACRONYM GIS
• Geographic Information Services
– Web-sites and service centers for casual users, e.g. travelers
– Example: Service (e.g. AAA, mapquest) for route planning
• Geographic Information Systems
– Software for professional users, e.g. cartographers
– Example: ESRI Arc/View software
• Geographic Information Science
– Concepts, frameworks, theories to formalize use and
development of geographic information systems and
services
– Example: design spatial data types and operations for
querying
• Exercise: Which meaning of the term GIS is closest to the 32
focus of the book titled “Spatial Databases: A Tour”?
WHAT IS A SPATIAL DATABASE

Database that:
• Stores spatial objects
• Manipulates spatial objects just like other objects
in the database

33
ADVANTAGES OF
SPATIAL DATABASES

34
Standard Spatial
Database Database
• Has data types • Has spatial data
– varchar types
– integer – point
– real – linestring
– date – polygon
– multipoint
– multilinestring
– multipolygon

35
Standard Database
• Has one-dimensional indexes
– b-tree
– hash

36
Spatial Database

• Has spatial indexes


– r-tree
– quad-tree
– grid

37
38
39
40
41
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 42
ADVANTAGES OF SPATIAL
DATABASES
Offset complicated tasks to the DB server
– organization and indexing done for you
– do not have to re-implement operators
– do not have to re-implement functions

Significantly lowers the development time of client


applications

43
ADVANTAGES OF SPATIAL
DATABASES
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 44
Original Polygons

Union Intersection 45
Buffered rivers

Original river network

46
Buffered rivers

Original river network

• … WHERE distance(<me>,pub_loc) < 1000


• SELECT distance(<me>,pub_loc)*$0.01 + beer_cost …
... WHERE touches(pub_loc, street)
• … WHERE inside(pub_loc,city_area) and city_name = ... 47
• Simple value of the proposed lot
• Area(<my lot>) * <price per acre>
+ area(intersect(<my log>,<forested area>) ) * <wood value per
acre> 48

- distance(<my lot>, <power lines>) * <cost of power line laying>


DISADVANTAGES OF SPATIAL DB

• Cost to implement can be high


• Some inflexibility
• Incompatibilities with some GIS software
• Slower than local, specialized data structures
• User/managerial inexperience and caution

49
SPATIAL DATABASE OFFERINGS

• ESRI ArcSDE (on top of several different


DBs)
• Oracle Spatial
• IBM DB2 Spatial Extender
• Informix Spatial DataBlade
• MS SQL Server (with ESRI SDE)
• Geomedia on MS Access
• PostGIS / PostgreSQL
50
CLASSICAL GIS APPLICATIONS

51
52
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
• Example: Oracle Spatial data cartridge, ESRI SDE, …
– can work with Oracle 8i DBMS
– Has spatial data types (e.g. polygon), operations (e.g.
overlap) callable from SQL3 query language
53
– Has spatial indices, e.g. R-trees
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, Fig 1.2 54
boundary polygon );
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.
– Figure 1.6 shows these components
– We discuss each component briefly in chapter 1.6 and in
more detail in later chapters.
55
Three Layer Architecture
Fig 1.6

56
VALUE OF SDBMS
Traditional (non-spatial) DBMS provide:
- Persistence across failures
- Allows concurrent access to data
- Scalability to search queries on very large datasets which do
not fit inside main memories of computers
- Efficient for non-spatial queries, but not for spatial queries.
Non-spatial queries:
- List the names of all bookstore with more than 10.000 titles.
- List the names of ten customers, in terms of sales, in the year
2010.
Spatial Queries:
- List the names of all bookstores with 10 miles of HCMC
- List all customers who live in HCMC and its adjoining 57
provinces
VALUE OF SDBMS – SPATIAL
DATA EXAMPLES
• Examples of non-spatial data
– Names, phone numbers, email addresses of people
• Examples of Spatial data
– Census 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
58
Value of SDBMS – Users,
Application Domains
• Many important application domains have spatial data and
queries. Some Examples follow:
– Army Field Commander: Has there been any significant
enemy troop movement since last night?
– Insurance Risk Manager: Which homes are most likely to
be affected in the next great flood on the Mississippi?
– Medical Doctor: Based on this patient's MRI, have we
treated somebody with a similar condition ?
– Molecular Biologist: Is the topology of the amino acid
biosynthesis gene in the genome found in any other
sequence feature map in the database ?
– Astronomer: Find all blue galaxies within 2 arcmin of
quasars.
• Home exercise: List two ways you have used spatial data.
59
Which software did you use to manipulate spatial data?
60
 SDBMS is valuable to many important applications
 SDBMS is a software module
– works with an underlying DBMS
– provides spatial ADTs callable from a query language
– provides methods for efficient processing of spatial queries

 Components of SDBMS include


– spatial data model, spatial data types and operators,
– spatial query language, processing and optimization
– spatial data mining

 SDBMS is used to store, query and share spatial data


for GIS as well as other applications 61
62

You might also like