Sie sind auf Seite 1von 48

ITM-520

Spatial Database
Management System
Harry Imantho, M.Sc

Bogor, May 3, 2016

Thursday, August 18, 16


Text Books
Spatial Database Systems
By Albert K.W.Yeung and G. Brent Hall
Spatial Databases : A Tour
By Shashi Shekhar and Sanjay Chawla

Spatial Databases: with application to GIS


By Philippe Rigaux, Michel Scholl,
and Agnes Voisard

Thursday, August 18, 16


Example of Applications
Small and Medium Enterprises Kota Bogor
SEAMEO Database on Education
Spatial Information System and Monitoring
PTPN 4 Medan
Spatial Dynamic Model for Regional
Development

Thursday, August 18, 16


Your Interest in Spatial Databases

Spatial databases provided the essential logic and structure


for a host interesting and creative applications, to support
planning, management and decision making. (e.g. natural
resources accounting, development planning, emergency
services routing, hospital placement, spatial modeling, game
environments).

Spatial database work with many other technologies (e.g.


Internet ,wireless networks, and GPS.)
--> Great source of ideas for your final projects (or master's
thesis).

Thursday, August 18, 16


Spatial Databases could integrate
with other applications and data
HTML Viewer
Java Viewer GIS Desktop
(Internet) Applications

Wireless
Mobile
Devices
Network
Custom
Applications

Map Renderer
Spatial Server Side
DB Applications

Thursday, August 18, 16


Definition of Database
Database an integrated set of data on a particular
subject. Can include spatial and non-spatial and
temporal data.
Databases offer many advantages over files.
Currently, relational databases dominate for non-
spatial use, ORDBMS used for spatial data.
Databases which do not include spatial feature,
address some limitations for specialist or dedicated
GIS.

Thursday, August 18, 16


What is a Spatial Database?
A spatial database is a database that is optimized to store and
query data related to objects in space, including points, lines
and polygons. It is a collection of spatially referenced data that acts as
a model of reality.

While typical databases can understand various numeric


and character types of data, additional functionality
needs to be added for databases to process spatial data types.
These are typically called geometry or feature (Geometry
data type).

Geographic objects have two components


Description non-spatial attributes
Spatial component spatial attributes
Geometric attributes such as location and shape

Topological attributes such as adjacency (relation among features)


Thursday, August 18, 16
Why Spatial Databases?
A DBMS is a way of storing information in a manner that
enforces consistency (avoids redundancy),
facilitates access; authorization, concurrency access
Allows users to relate data from multiple tables
Queries to databases are posed in high level declarative manner
(high level programming) --> using SQL (Structured Query
Language).
SQL is the lingua-franca in the commercial database world.
SQL3/OGIS1 supports several spatial data types and operations.
We will study the Open Geospatial Consortium (OGC)
Standards.

Thursday, August 18, 16


Why Spatial Databases?

Thursday, August 18, 16


Types of Data Stored in
Spatial Databases
Three-dimensional examples
Weather
Cartesian coordinates (3-D)
Satellite images

Two-dimensional examples
Cartesian coordinates (2-D)
Networks
Direction

Thursday, August 18, 16


Spatial Database
Management System
Spatial Database Management System (SDBMS) is a
system that provides the capabilities of a traditional
database management system (DBMS) while allowing
special storage and handling of spatial data.
A SDBMS is a software module that
can work with an underlying DBMS

supports spatial data models, spatial abstract data types (ADTs)

Supports querying language specific to spatial data types


supports spatial indexing, efficient algorithms for processing spatial
operations, and domain specific rules for query optimization (provides
handling of spatial data and operations)
Thursday, August 18, 16
Concept of Spatial DBMS

Added

Enhanced

Added

Thursday, August 18, 16


Spatial DBMS Example
Consider a spatial dataset with:
County boundary,
Census block - name, area, population, boundary

Storage in database would be:


create table census_blocks ( name string, area float, population
number, boundary polygon );
(0,1) (1,1)
cencus_blocks
Name Area Population Boundary
MultiPolygon((0,0),(0,1),(1,1),
1010 1050 1 1800
(1,0))

(0,0) (1,0)
INSERT INTO boston_buildings(name, area, population, boundary) VALUES('some name', 'some area',
'some pop', ST_GeomFromText('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326) )
Thursday, August 18, 16
Value of SDBMS
Non-spatial database management systems 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, i.e:
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.
Spatial Queries:
List the names of all bookstores with ten miles of Minneapolis
List all customers who live in Tennessee and its adjoining states

Thursday, August 18, 16


Value of SDBMS Users,
Application Domains
Many important application domains have spatial data and queries.
Some Examples follow:

Mobile phone users: Find the nearest gas station, ATM, hotels.

Insurance Risk Manager: Which homes are most likely to be affected


in the next great flood?

Climatologist: To verify their global warming model.

Supply manager: To find the best places to build distribution


warehouses.

Farmer: To develop precision agriculture.

Urban specialist: To develop new urban/urban planning developement.


Thursday, August 18, 16
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


Thursday, August 18, 16
How is a SDBMS different from a GIS?
SDBMS focuses on
storage and management of all types of data including
geographic data,
Efficient querying,/retrieving, 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, ...
Thursday, August 18, 16
How is a SDBMS different from a GIS?

SDBMS,
do not have spatial analytic and visualization tools
common to GIS,

do not have graphical data,


do not have visualization capability.

Thursday, August 18, 16


SDBMS Component:
SDBMS Three-layer Structure

SDBMS works with a spatial application at the


front end and a DBMS at the back end
SDBMS has three layers:
Interface to spatial application
Core spatial functionality
Interface to DBMS

Thursday, August 18, 16


SDBMS Three-layer
Structure
Spatial application GIS Software, CAD

Interface to spatial application

Functionality
Core Spatial
Access methods
Algorithms
Query language
Operations
Data types
Taxonomy

Interface to DBMS

DBMS

Thursday, August 18, 16


Spatial Taxonomy

Taxonomy is a system for describing and


representing similarity of properties, behaviors,
relationship and constraint within a particular
domain (group).
Rules to identify identifiable objects and properties
of space, and topology model relationship.
Object model help manage identifiable things;
Specify structure or schema of a data set
Document description of data
Facilitates early analysis of some properties e.g., querying ability,
redundancy, consistency, storage space requirements, etc.

Thursday, August 18, 16


Object model concepts
Objects: distinct identifiable things relevant to an application
Objects have attributes and operations
Attribute: a simple (e.g. numeric, string) property of an object
Operations: function maps object attributes to other objects

Example from a roadmap


Objects: roads, landmarks, ...
Attributes of road objects:
spatial: location, e.g. polygon boundary of land-parcel
non-spatial: name (e.g. Route 66), type (e.g. interstate, residential
street), number of lanes, speed limit,
Operations on road objects: determine center line, determine length,
determine intersection with other roads, ...

Thursday, August 18, 16


Classifying Spatial
objects
Spatial objets are spatial attributes of general objects
Spatial objects are of many types
Simple
0- dimensional (points), 1 dimensional (curves), 2 dimensional (surfaces)

Collections
Polygon collection (e.g. administrative boundary)

Thursday, August 18, 16


An example...

Thursday, August 18, 16


Spatial Types:
Open Geospatial Consortium (OGC)
Simple Features for SQL

Thursday, August 18, 16


Spatial Types OGC Simple
Features for SQL Composed

Sub Type
Geometry SpatialReferenceSystem
Relationship

Point Curve Surface GeometryCollection

LineString Polygon MultiSurface MultiCurve MultiPoint

Line LinearRing
MultiPolygon MultiLineString

Thursday, August 18, 16


Data Types
Data types are a way to limit the kind of data that can
be used by a particular program or stored in a
database table. Types restrict the data to a certain set
of values (e.g. 1,2,3,..for Integers).

Data types also are restricted to certain


operations on the type (e.g. addition for Integers).
ORDBMS, i.e: PostgreSQL can be extended to have
additional types e.g. spatial data types.
SQL comes with a range of standard data types that
can be used to represent strings, integers, etc,

Thursday, August 18, 16


Operations OGC Simple Feature Types

Thursday, August 18, 16


Topological Operator

0 0 1 1 1 1 1 0 0 1 0 0
0 0 1 0 0 1 1 0 0 0 1 0
1 1 1 0 0 1 1 1 1 0 0 1
disjoint contains inside equal

0 0 1 1 1 1 1 0 0 1 1 1
0 1 1 0 1 1 1 1 0 1 1 1
1 1 1 0 0 1 1 1 1 1 1 1
meet covers coveredBy overlap

Thursday, August 18, 16


Topological Operator:
Contains Relation
Does the base geometry (small circles) contain the comparison geometry (big
circles)?

Thursday, August 18, 16


Topological Operator:
Touches Relation
Does the base geometry (small circles) touch the comparison geometry (big circles) ?

Two geometries touch when their boundaries intersect.

Thursday, August 18, 16


Spatial Analysis Operator
Distance shortest distance
Buffer geometric buffer
Intersection points common to two geometries
Union all points in geometries
Difference points different between two
geometries
SymDifference points in either, but not both of
input geometries

Thursday, August 18, 16


Within Relation
SELECT a.id, a.name, a.geom as point INTO vw_location
FROM building a, region b
WHERE st_within(a.geom, b.geom) AND b.name ='KwaZulu';

Thursday, August 18, 16


Try this...
SELECT b.name FROM region a, region b
WHERE ST_TOUCHES(a.geom, b.geom)
AND a.name = Hokkaido;

SELECT b.gid, b.name, b.the_geom FROM region a, region b


WHERE ST_DISTANCE (a.geom, b.geom) < 100
AND a.name = Hokkaido AND b.name != Hokkaido;

SELECT gid, ST_BUFFER(geom, 100) as geom INTO vw_buffer FROM region


WHERE name = 'Hokkaido';

Thursday, August 18, 16


Operations on themes

Find the countries of western Europe with population greater than 50 million. This is a
projection on the attribute population.

Thursday, August 18, 16


Theme Overlay

The lower map represents the overlay of European countries and languages.

Thursday, August 18, 16


Indexing
Indexing is used to speed up queries and locate rows
quickly
Traditional RDBMS use 1-D indexing (such as: B-tree)
Spatial DBMS need 2-D, hierarchical indexing;
R-tree
PostGIS uses R-Tree index implemented on top of
GiST to index GIS data

Thursday, August 18, 16


R-Tree Motivation
y axis
10 m
g h
8 l
k
e f
6
i j
Boston
d
4
b a
2 c

x axis
0 2 4 6 8 10
Range query: find the objects in a given range.
E.g. find all hotels in Boston.

No index: scan through all objects. NOT EFFICIENT!


Thursday, August 18, 16
R-Tree:
Clustering by Proximity
E2
E1 E7

E5
E6
E4

Thursday, August 18, 16


R-Tree
E2
E1 E7

E6

Thursday, August 18, 16


R-Tree

Thursday, August 18, 16


Database Architecture for GIS
Loosely Coupled
Some commercial software such as ArcInfo use this approach.

Uses a RDBMS to store 'attribute' or descriptive information e.g. the


name of a road not its geometry.

A specific module for spatial data management.

Drawbacks:

The coexistence of heterogeneous data models, which implies


difficulties in modeling use and integration.

A partial loss of DBMS techniques e.g. recovery, querying,


optimization.

Thursday, August 18, 16


Loosely Coupled
Application Programs

Relational DBMS Geometric Processing


(GIS)

Database Files

Thursday, August 18, 16


Database Architecture for GIS

Integrated (store spatial and attribute in one DBMS)


Most commercial databases that offer facilities to handle spatial data
(PostgreSQL, Oracle, DB2) take this approach. The basic idea is to add
new types and operations to the RM as follows:

The query language is extended to manipulate spatial data as well as


descriptive data. New spatial types (point, line, and polygon) are handled
as basic types by the DBMS.

Many other DBMS functions such as query optimization, are adapted in


order to handle geo-spatial data efficiently.

Drawback: Does not provide full GIS functionality (cartography). We


must use additional software such as Geoserver to make (or render) an
attractive map from the raw vectors stored in the DBMS.

Thursday, August 18, 16


Integrated
Spa$al&Applica$on&
(Desktop,&Web,&Mobile)&

Spa$al&Object&and&A0ribute&
stored&in&one&DBMS&

Thursday, August 18, 16


HOW Spatial
Databases Fit into GIS
LAN
Internet
Editing
GIS
Loading Mapping
Database Web
Analysis Features Client
GIS Other

Thursday, August 18, 16


Thank you...

Question/discussion.....

Thursday, August 18, 16


What can PostGIS do?

PostGIS supports a geometry type which is compliant with the


OGC standard for Simple Features.

POINT( 50 100 )

LINESTRING ( 10 10, 20 20 )

POLYGON ( ( 0 0, 5 5, 5 0, 0 0 ) )

MULTIPOINT ( ( 1 1 ), ( 0 0 ) )

MULTILINESTRING ( )

MULTIPOLYGON ( )

Thursday, August 18, 16

Das könnte Ihnen auch gefallen