I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database Organization
Spatial Database Organization
and Management
and Management
Dr. Harish Karnatak
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database
Spatial Database-
- What it is? (cont.)
What it is? (cont.)
� A spatial database is a database that is optimized to
store and query data that is related to objects in space,
including points, lines and polygons.
� 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.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database
Spatial Database-
- What it is? (cont.)
What it is? (cont.)
In addition to typical SQL queries such as SELECT, CREATE
statements, spatial databases can perform a wide variety of
spatial operations like:
• Spatial Measurements: Finds the distance between
points, polygon area, 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 such as 'is
there a residence located within a mile of the area we
are planning to build the landfill?‘
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database
Spatial Database-
- What it is? (cont.)
What it is? (cont.)
In addition to typical SQL queries such as SELECT, CREATE
statements, spatial databases can perform a wide variety
of spatial operations like:
• Constructor Functions: Creates new features with an
SQL query specifying the vertices (points of nodes)
which can make up lines. If the first and last vertex of a
line are identical the feature can also be of the type
polygon (a closed line).
• Observer Functions: Queries which return specific
information about a feature such as the location of the
center of a circle
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database
Spatial Database-
- What it is? (cont.)
What it is? (cont.)
Due to these special characteristics and specific query
requirement, a standard database management system
may not be sufficient for storage and management of
spatial data. However many industry standard RDBMS
packages are now supporting spatial objects inside
RDBMS.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Databases Background
Spatial Databases Background
� Spatial databases provide structures for storage
and analysis of spatial data
� Spatial data is comprised of objects in multi­
dimensional space
� Storing spatial data in a standard database
would require excessive amounts of space
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Databases Background
Spatial Databases Background (Cont.)
(Cont.)
� Queries to retrieve and analyze spatial data from
a standard database would be long and
cumbersome leaving a lot of room for error
� Spatial databases provide much more efficient
storage, retrieval, and analysis of spatial data
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Data types in Spatial Databases
Data types in Spatial Databases
� Two-dimensional data examples
� Geographical
� Cartesian coordinates (2-D)
� Networks
� Direction
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Data types in Spatial Databases
Data types in Spatial Databases (Cont.)
(Cont.)
� Three-dimensional data examples
� Weather
� Cartesian coordinates (3-D)
� Topological
� Satellite images
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
What is a Spatial Database?
What is a Spatial Database?
� A SDBMS is a DBMS
� It offers spatial data types/data models/ query
language
� Support spatial properties/operations
� It supports spatial data types in its
implementation
� Support spatial indexing, algorithms for spatial
selection and join
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Representation
Spatial Representation
� Raster model:
� Vector model:
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial data types
Spatial data types
region
point
line
� Point : 2 real numbers
� Line : sequence of points
� Region : area included inside n-points
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Examples
Examples
� A database:
� Relation states(sname: string, area: region, spop: int)
� Relation cities(cname: string, center: point; ext: region)
� Relation rivers(rname: string, route:line)
� SELECT * FROM rivers WHERE route intersects R
� SELECT cname, sname FROM cities, states WHERE
center inside area
� SELECT rname, length(intersection(route, California))
FROM rivers WHERE route intersects California
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Queries
Spatial Queries
� Selection queries: “Find all objects inside query q”,
inside-> intersects, north
� Nearest Neighbor-queries: “Find the closets object to a
query point q”, k-closest objects
� Spatial join queries: Two spatial relations S1 and S2, find all
pairs: {x in S1, y in S2, and x rel y= true}, rel= intersect,
inside, etc
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Indexes
Spatial Indexes
Used to speed up spatial queries
Example:
� Point query: return the geometric object that contains a
given query point
� Sequentially scanning all objects of a large collection to
check whether they contain the query point involves a
high number of disk accesses and the repetition of the
evaluation of computationally expensive geometric
predicates (e.g., containment, intersection, etc.)
� Reducing the set of objects to be processed is highly
desirable
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Indexes for object
Indexes for object-
-based and space
based and space-
-based
based
representations
representations
� Indexes for raster data: based on recursive
subdivision of the space, example: quadtrees
� Indexes for vector data: differ depending on the
type of data (extensions of quadtrees are used
also for vector data).
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Vector Data Indexing
Vector Data Indexing
• Different indexing methods are used for point, linear and
polygonal data
• In the case of collections of polygons, instead of
indexing the object geometries themselves, whose
shapes might be complex, we consider an approximation
of the geometry and index it instead
• Most commonly used approximation: minimum bounding
rectangle (MBR) also called minimum bounding box
(MBB)
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
MBRs
MBRs
• By using the MBR as the geometric key for building the
spatial index, we save the cost of evaluating expensive
geometric predicates during index traversal (as geometric
tests against an MBR is constant)
• Example: point-in-polygon test
(x,y) (x,y)
• In addition, the space required to store a rectangle is
constant (2 points)
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
MBRs (cont.)
MBRs (cont.)
� An operation involving a spatial predicate on a collection
of objects indexed on their MBRs is performed in two
steps:
1. Filter step: selects the objects whose MBR satisfies the spatial
predicate (by traversing the spatial index and applying the
predicate to the MBRs)
2. Refinement step: the objects that pass the filter step are a
superset of the solution. An MBR might satisfy the predicate
but the corresponding object might not
obj
MBR
P
P
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Indexing Methods
Spatial Indexing Methods
� The popular indexing technique those are in practice in
industry standard RDBMS are:
� Quadtree
� Octree
� UB-tree
� R-tree
� R+ tree
� R* tree
� Hilbert R-tree
Two methods are most popular in SDBMS:
� R-trees
� Quadtrees
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Databases Uses and Users
Spatial Databases Uses and Users
� Three types of uses
� Manage spatial data
� Analyze spatial data
� High level utilization
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database Management System
Spatial Database Management System
� Spatial Database Management System (SDBMS)
provides the capabilities of a traditional database
management system (DBMS) while allowing
special storage and handling of spatial data.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database Management System
Spatial Database Management System
(Cont.)
(Cont.)
� SDBMS:
� Works with an underlying DBMS
� Allows spatial data models and types
� Supports querying language specific to spatial data
types
� Provides handling of spatial data and operations
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
SDBMS Three
SDBMS Three-
-layer Structure
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
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
SDBMS Three
SDBMS Three-
-layer Structure
layer Structure (Cont.)
(Cont.)
Spatial
application
DBMS
Interface
to
DBMS
Interface
to
spatial
application
Core Spatial
Functionality
• Taxonomy
• Data types
• Operations
• Query language
• Algorithms
• Access methods
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Query Language
Spatial Query Language
� Number of specialized adaptations of SQL
�Spatial query language
�Temporal query language (TSQL2)
�Object query language (OQL)
�Object oriented structured query
language (O2SQL)
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Query Language Operations
Spatial Query Language Operations
� Three types of queries:
� Basic operations on all data types (e.g. IsEmpty,
Envelope, Boundary)
� Topological/set operators (e.g. Disjoint, Touch,
Contains)
� Spatial analysis (e.g. Distance, Intersection,
SymmDiff)
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Relations
Spatial Relations
� Topological Relations: containment, overlapping, etc.
[Egenhofer et al. 1991]
A B
B
A
� Metric Relations: distance between objects, etc. [Gold and
Roos 1994]
A
1 Km
A B B
� Direction Relations: north of, south of, etc. [Hernandez et
al. 1990; Frank et al. 1991]
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
SDBMS
SDBMS
� The Organizing and management of geo-spatial data
inside DBMS or RDBMS has emerged as an exciting and
challenging area for GIS professionals during last decade
which is known as Spatial Database Management
System (SDBMS).
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Geodatabase Model
Geodatabase Model
The Geodatabase is the common data storage and
management framework for ArcGIS. It combines "geo"
(spatial data) with "database" (data repository) to create
a central data repository for spatial data storage and
management.. It can be leveraged in desktop, server, or
mobile environments and allows to the users to store
GIS data in a central location for easy access and
management.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Geodatabase Model
Geodatabase Model
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Geodatabase Model
Geodatabase Model
Enterprise Workgroup Desktop
Application Scenario Large-scale enterprise
application scenarios
Small- to medium-sized
departmental application
scenarios
Small teams or a single
user.
Data Storage Enterprise RDBMS Platform
• DB2
• Informix
• Oracle
• PostgreSQL
• SQL Server
SQL Server Express SQL Server Express
Management Interface ArcCatalog, RDBMS , ArcSDE
command line
ArcCatalog ArcCatalog
Storage Capacity Depends on the server 10 GB 10 GB
Licensing Availability ArcGIS for Server Enterprise ArcGIS for Server Workgroup ArcGIS Engine, ArcGIS for
Desktop Advanced , ArcGIS
for Desktop Standard
Supported OS Platform Any platform Windows Windows
Number of Concurrent
Users
Unlimited editors and readers 10 editors and readers 1 editor and 3 readers
Network Application Intranet and Internet Intranet and Internet Desktop and local network
use
Differentiating
Characteristics
• Supports versioning
• Supports multiuser editing
• Supports spatial types
• Enterprise IT integration
• Supports versioning
• Supports multiuser editing
• Supports versioning
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
POSTGIS Model
POSTGIS Model
� PostGIS "spatially enables" the PostgreSQL server, allowing it to be
used as a backend spatial database for geographic information
systems (GIS), much like ESRI's SDE or Oracle's Spatial extension.
� PostGIS follows the OpenGIS "Simple Features Specification for
SQL" and has been certified as compliant with the "Types and
Functions" profile.
� PostGIS development was started by Refractions Research as a
project in open source spatial database technology.
� PostGIS is released under the GNU General Public License.
� PostGIS continues to be developed by a group of contributors led by
a Project Steering Committee and new features continue to be
added.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
POSTGIS Model
POSTGIS Model
PostGIS supports storage of the following GIS object
types:
� POINT
� LINE
� POLYGON
� MULTIPOINT
� MULTILINE
� MULTIPOLYGON
� GEOMETRYCOLLECTION
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Features of POSTGIS
Features of POSTGIS
� Geometry types for points, linestrings, polygons,
multipoints, multilinestrings, multipolygons and
geometrycollections.
� Spatial predicates for determining the interactions of
geometries using the 3x3 Egenhofer matrix (provided by
the GEOS software library).
� Spatial operators for determining geospatial
measurements like area, distance, length and perimeter.
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Features of POSTGIS
Features of POSTGIS
� Spatial operators for determining geospatial set
operations, like union, difference, symmetric difference
and buffers (provided by GEOS).
� R-tree-over-GiST (Generalised Search Tree) spatial
indexes for high speed spatial querying.
� Index selectivity support, to provide high performance
query plans for mixed spatial/non-spatial queries.
� For raster data, under development PostGIS WKT Raster
(now integrated into PostGIS 2.0 and renamed PostGIS
Raster).
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Data Entity Creation
Spatial Data Entity Creation
� Form an entity to hold county names, states,
populations, and geographies
CREATE TABLE County(
Name varchar(30),
State varchar(30),
Pop Integer,
Shape Polygon);
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Data Entity Creation (Cont.)
Spatial Data Entity Creation (Cont.)
� Form an entity to hold river names, sources,
lengths, and geographies
CREATE TABLE River(
Name varchar(30),
Source varchar(30),
Distance Integer,
Shape LineString);
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Example Spatial Query
Example Spatial Query
� Find all the counties that border on Contra Costa
county
SELECT C1.Name
FROM County C1, County C2
WHERETouch(C1.Shape, C2.Shape) = 1
AND C2.Name = ‘Contra Costa’;
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Example Spatial Query
Example Spatial Query (Cont.)
(Cont.)
� Find all the counties through which the Merced
river runs
SELECT C.Name, R.Name
FROM County C, River R
WHEREIntersect(C.Shape, R.Shape) = 1
AND R.Name = ‘Merced’;
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Types of queries
Types of queries -
- PostGIS
PostGIS
The function names for queries differ across
geodatabases. The following list contains
commonly used functions built into PostGIS, a
free geodatabase which is a PostgreSQL
extension (the term 'geometry' refers to a point,
line, box or other two or three dimensional
shape):
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Types of queries
Types of queries -
- PostGIS
PostGIS (Cont.)
(Cont.)
1. Distance(geometry, geometry) : number
2. Equals(geometry, geometry) : boolean
3. Disjoint(geometry, geometry) : boolean
4. Intersects(geometry, geometry) : boolean
5. Touches(geometry, geometry) : boolean
6. Crosses(geometry, geometry) : boolean
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Types of queries
Types of queries -
- PostGIS
PostGIS (Cont.)
(Cont.)
7. Overlaps(geometry, geometry) : boolean
8. Contains(geometry, geometry) : boolean
9. Intersects(geometry, geometry) : boolean
10. Length(geometry) : number
11. Area(geometry) : number
12. Centroid(geometry) : geometry
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
Spatial Database Applications
Spatial Database Applications
� GIS applications (maps):
� Urban planning, route optimization, fire or
pollution monitoring, utility networks, etc
� Other applications:
� VLSI design, CAD/CAM, model of human brain, etc
� Traditional applications:
� Multidimensional records
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N
I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N

SPATIAL DB IN DATABASE MANAGEMENT SYSTEM

  • 1.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Organization Spatial Database Organization and Management and Management Dr. Harish Karnatak
  • 2.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Spatial Database- - What it is? (cont.) What it is? (cont.) � A spatial database is a database that is optimized to store and query data that is related to objects in space, including points, lines and polygons. � 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.
  • 3.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Spatial Database- - What it is? (cont.) What it is? (cont.) In addition to typical SQL queries such as SELECT, CREATE statements, spatial databases can perform a wide variety of spatial operations like: • Spatial Measurements: Finds the distance between points, polygon area, 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 such as 'is there a residence located within a mile of the area we are planning to build the landfill?‘
  • 4.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Spatial Database- - What it is? (cont.) What it is? (cont.) In addition to typical SQL queries such as SELECT, CREATE statements, spatial databases can perform a wide variety of spatial operations like: • Constructor Functions: Creates new features with an SQL query specifying the vertices (points of nodes) which can make up lines. If the first and last vertex of a line are identical the feature can also be of the type polygon (a closed line). • Observer Functions: Queries which return specific information about a feature such as the location of the center of a circle
  • 5.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Spatial Database- - What it is? (cont.) What it is? (cont.) Due to these special characteristics and specific query requirement, a standard database management system may not be sufficient for storage and management of spatial data. However many industry standard RDBMS packages are now supporting spatial objects inside RDBMS.
  • 6.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Databases Background Spatial Databases Background � Spatial databases provide structures for storage and analysis of spatial data � Spatial data is comprised of objects in multi­ dimensional space � Storing spatial data in a standard database would require excessive amounts of space
  • 7.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Databases Background Spatial Databases Background (Cont.) (Cont.) � Queries to retrieve and analyze spatial data from a standard database would be long and cumbersome leaving a lot of room for error � Spatial databases provide much more efficient storage, retrieval, and analysis of spatial data
  • 8.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Data types in Spatial Databases Data types in Spatial Databases � Two-dimensional data examples � Geographical � Cartesian coordinates (2-D) � Networks � Direction
  • 9.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Data types in Spatial Databases Data types in Spatial Databases (Cont.) (Cont.) � Three-dimensional data examples � Weather � Cartesian coordinates (3-D) � Topological � Satellite images
  • 10.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N What is a Spatial Database? What is a Spatial Database? � A SDBMS is a DBMS � It offers spatial data types/data models/ query language � Support spatial properties/operations � It supports spatial data types in its implementation � Support spatial indexing, algorithms for spatial selection and join
  • 11.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Representation Spatial Representation � Raster model: � Vector model:
  • 12.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial data types Spatial data types region point line � Point : 2 real numbers � Line : sequence of points � Region : area included inside n-points
  • 13.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Examples Examples � A database: � Relation states(sname: string, area: region, spop: int) � Relation cities(cname: string, center: point; ext: region) � Relation rivers(rname: string, route:line) � SELECT * FROM rivers WHERE route intersects R � SELECT cname, sname FROM cities, states WHERE center inside area � SELECT rname, length(intersection(route, California)) FROM rivers WHERE route intersects California
  • 14.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Queries Spatial Queries � Selection queries: “Find all objects inside query q”, inside-> intersects, north � Nearest Neighbor-queries: “Find the closets object to a query point q”, k-closest objects � Spatial join queries: Two spatial relations S1 and S2, find all pairs: {x in S1, y in S2, and x rel y= true}, rel= intersect, inside, etc
  • 15.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Indexes Spatial Indexes Used to speed up spatial queries Example: � Point query: return the geometric object that contains a given query point � Sequentially scanning all objects of a large collection to check whether they contain the query point involves a high number of disk accesses and the repetition of the evaluation of computationally expensive geometric predicates (e.g., containment, intersection, etc.) � Reducing the set of objects to be processed is highly desirable
  • 16.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Indexes for object Indexes for object- -based and space based and space- -based based representations representations � Indexes for raster data: based on recursive subdivision of the space, example: quadtrees � Indexes for vector data: differ depending on the type of data (extensions of quadtrees are used also for vector data).
  • 17.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Vector Data Indexing Vector Data Indexing • Different indexing methods are used for point, linear and polygonal data • In the case of collections of polygons, instead of indexing the object geometries themselves, whose shapes might be complex, we consider an approximation of the geometry and index it instead • Most commonly used approximation: minimum bounding rectangle (MBR) also called minimum bounding box (MBB)
  • 18.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N MBRs MBRs • By using the MBR as the geometric key for building the spatial index, we save the cost of evaluating expensive geometric predicates during index traversal (as geometric tests against an MBR is constant) • Example: point-in-polygon test (x,y) (x,y) • In addition, the space required to store a rectangle is constant (2 points)
  • 19.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N MBRs (cont.) MBRs (cont.) � An operation involving a spatial predicate on a collection of objects indexed on their MBRs is performed in two steps: 1. Filter step: selects the objects whose MBR satisfies the spatial predicate (by traversing the spatial index and applying the predicate to the MBRs) 2. Refinement step: the objects that pass the filter step are a superset of the solution. An MBR might satisfy the predicate but the corresponding object might not obj MBR P P
  • 20.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Indexing Methods Spatial Indexing Methods � The popular indexing technique those are in practice in industry standard RDBMS are: � Quadtree � Octree � UB-tree � R-tree � R+ tree � R* tree � Hilbert R-tree Two methods are most popular in SDBMS: � R-trees � Quadtrees
  • 21.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Databases Uses and Users Spatial Databases Uses and Users � Three types of uses � Manage spatial data � Analyze spatial data � High level utilization
  • 22.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Management System Spatial Database Management System � Spatial Database Management System (SDBMS) provides the capabilities of a traditional database management system (DBMS) while allowing special storage and handling of spatial data.
  • 23.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Management System Spatial Database Management System (Cont.) (Cont.) � SDBMS: � Works with an underlying DBMS � Allows spatial data models and types � Supports querying language specific to spatial data types � Provides handling of spatial data and operations
  • 24.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N SDBMS Three SDBMS Three- -layer Structure 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
  • 25.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N SDBMS Three SDBMS Three- -layer Structure layer Structure (Cont.) (Cont.) Spatial application DBMS Interface to DBMS Interface to spatial application Core Spatial Functionality • Taxonomy • Data types • Operations • Query language • Algorithms • Access methods
  • 26.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Query Language Spatial Query Language � Number of specialized adaptations of SQL �Spatial query language �Temporal query language (TSQL2) �Object query language (OQL) �Object oriented structured query language (O2SQL)
  • 27.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Query Language Operations Spatial Query Language Operations � Three types of queries: � Basic operations on all data types (e.g. IsEmpty, Envelope, Boundary) � Topological/set operators (e.g. Disjoint, Touch, Contains) � Spatial analysis (e.g. Distance, Intersection, SymmDiff)
  • 28.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Relations Spatial Relations � Topological Relations: containment, overlapping, etc. [Egenhofer et al. 1991] A B B A � Metric Relations: distance between objects, etc. [Gold and Roos 1994] A 1 Km A B B � Direction Relations: north of, south of, etc. [Hernandez et al. 1990; Frank et al. 1991]
  • 29.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N SDBMS SDBMS � The Organizing and management of geo-spatial data inside DBMS or RDBMS has emerged as an exciting and challenging area for GIS professionals during last decade which is known as Spatial Database Management System (SDBMS).
  • 30.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Geodatabase Model Geodatabase Model The Geodatabase is the common data storage and management framework for ArcGIS. It combines "geo" (spatial data) with "database" (data repository) to create a central data repository for spatial data storage and management.. It can be leveraged in desktop, server, or mobile environments and allows to the users to store GIS data in a central location for easy access and management.
  • 31.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Geodatabase Model Geodatabase Model
  • 32.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Geodatabase Model Geodatabase Model Enterprise Workgroup Desktop Application Scenario Large-scale enterprise application scenarios Small- to medium-sized departmental application scenarios Small teams or a single user. Data Storage Enterprise RDBMS Platform • DB2 • Informix • Oracle • PostgreSQL • SQL Server SQL Server Express SQL Server Express Management Interface ArcCatalog, RDBMS , ArcSDE command line ArcCatalog ArcCatalog Storage Capacity Depends on the server 10 GB 10 GB Licensing Availability ArcGIS for Server Enterprise ArcGIS for Server Workgroup ArcGIS Engine, ArcGIS for Desktop Advanced , ArcGIS for Desktop Standard Supported OS Platform Any platform Windows Windows Number of Concurrent Users Unlimited editors and readers 10 editors and readers 1 editor and 3 readers Network Application Intranet and Internet Intranet and Internet Desktop and local network use Differentiating Characteristics • Supports versioning • Supports multiuser editing • Supports spatial types • Enterprise IT integration • Supports versioning • Supports multiuser editing • Supports versioning
  • 33.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N POSTGIS Model POSTGIS Model � PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. � PostGIS follows the OpenGIS "Simple Features Specification for SQL" and has been certified as compliant with the "Types and Functions" profile. � PostGIS development was started by Refractions Research as a project in open source spatial database technology. � PostGIS is released under the GNU General Public License. � PostGIS continues to be developed by a group of contributors led by a Project Steering Committee and new features continue to be added.
  • 34.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N POSTGIS Model POSTGIS Model PostGIS supports storage of the following GIS object types: � POINT � LINE � POLYGON � MULTIPOINT � MULTILINE � MULTIPOLYGON � GEOMETRYCOLLECTION
  • 35.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Features of POSTGIS Features of POSTGIS � Geometry types for points, linestrings, polygons, multipoints, multilinestrings, multipolygons and geometrycollections. � Spatial predicates for determining the interactions of geometries using the 3x3 Egenhofer matrix (provided by the GEOS software library). � Spatial operators for determining geospatial measurements like area, distance, length and perimeter.
  • 36.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Features of POSTGIS Features of POSTGIS � Spatial operators for determining geospatial set operations, like union, difference, symmetric difference and buffers (provided by GEOS). � R-tree-over-GiST (Generalised Search Tree) spatial indexes for high speed spatial querying. � Index selectivity support, to provide high performance query plans for mixed spatial/non-spatial queries. � For raster data, under development PostGIS WKT Raster (now integrated into PostGIS 2.0 and renamed PostGIS Raster).
  • 37.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Data Entity Creation Spatial Data Entity Creation � Form an entity to hold county names, states, populations, and geographies CREATE TABLE County( Name varchar(30), State varchar(30), Pop Integer, Shape Polygon);
  • 38.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Data Entity Creation (Cont.) Spatial Data Entity Creation (Cont.) � Form an entity to hold river names, sources, lengths, and geographies CREATE TABLE River( Name varchar(30), Source varchar(30), Distance Integer, Shape LineString);
  • 39.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Example Spatial Query Example Spatial Query � Find all the counties that border on Contra Costa county SELECT C1.Name FROM County C1, County C2 WHERETouch(C1.Shape, C2.Shape) = 1 AND C2.Name = ‘Contra Costa’;
  • 40.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Example Spatial Query Example Spatial Query (Cont.) (Cont.) � Find all the counties through which the Merced river runs SELECT C.Name, R.Name FROM County C, River R WHEREIntersect(C.Shape, R.Shape) = 1 AND R.Name = ‘Merced’;
  • 41.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Types of queries Types of queries - - PostGIS PostGIS The function names for queries differ across geodatabases. The following list contains commonly used functions built into PostGIS, a free geodatabase which is a PostgreSQL extension (the term 'geometry' refers to a point, line, box or other two or three dimensional shape):
  • 42.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Types of queries Types of queries - - PostGIS PostGIS (Cont.) (Cont.) 1. Distance(geometry, geometry) : number 2. Equals(geometry, geometry) : boolean 3. Disjoint(geometry, geometry) : boolean 4. Intersects(geometry, geometry) : boolean 5. Touches(geometry, geometry) : boolean 6. Crosses(geometry, geometry) : boolean
  • 43.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Types of queries Types of queries - - PostGIS PostGIS (Cont.) (Cont.) 7. Overlaps(geometry, geometry) : boolean 8. Contains(geometry, geometry) : boolean 9. Intersects(geometry, geometry) : boolean 10. Length(geometry) : number 11. Area(geometry) : number 12. Centroid(geometry) : geometry
  • 44.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N Spatial Database Applications Spatial Database Applications � GIS applications (maps): � Urban planning, route optimization, fire or pollution monitoring, utility networks, etc � Other applications: � VLSI design, CAD/CAM, model of human brain, etc � Traditional applications: � Multidimensional records
  • 45.
    I N DI A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N I N D I A N I N S T I T U T E O F R E M O T E S E N S I N G , D E H R A D U N