Chapter 2: Spatial Concepts and Data Models
Chapter 2: Spatial Concepts and Data Models
2.1 Introduction
2.2 Models of Spatial Information
2.3 Three-Step Database Design
2.4 Extending ER with Spatial Concepts
2.5 Summary
Learning Objectives
Learning Objectives (LO)
LO1: Understand concept of data models
• What is a data model?
• Why use data models?
LO2 : Understand the models of spatial information
LO3: Understand the 3-step design of databases
LO4: Learn about the trends in spatial data models
• Examples:
•GIS organize spatial set as a set of layers
•Databases organize dataset as a collection of tables
Why Data Models?
• Data models facilitate
• Early analysis of properties, e.g. storage cost, querying ability, ...
• Reuse of shared data among multiple applications
• Exchange of data across organization
• Conversion of data to new software / environment
• Example- Y2K crisis for year 2000
Many computer software systems were developed without well-defined data
models in 1960s and 1970s. These systems used a variety of data models for
representing time and date. Some of the representations used two digits to
represent years. In late 1990s, people worried that the 2 digit representation
of year may lead to errorneous behaviour. For example age of a person born
in 1960 (represented as 60) in year 2000 (represented as 00) may appear
negative and may be flagged as illegal data item. A large amount of effort and
resources (hundreds of Billions of dollars) was spent in revising the software.
Proper use of data model may have significantly reduced the costs. If time
and date were modeled as abstract data types in a software, only a small
portion of the software implementing the date ADT had to be reviewed and
revised.
Types of Data Models
•Two Types of data models
•Generic data models
•Developed for business data processing
•Support simple abstract data types (ADTs), e.g. numbers, strings, date
•Not convenient for spatial ADTs, e.g. polygons
•Recall a polygon becomes dozens of rows in 3 tables (Fig. 1.4, pp. 8)
•Need to extend with spatial concepts, e.g. ADTs
•Application Domain specific, e.g. spatial models
•Set of concepts developed in Geographic Info. Science
•Common spatial ADTs across different GIS applications
•Plan of Study
•First study concepts in spatial models
•Then study generic model
•Finally put the two together
Learning Objectives
Learning Objectives (LO)
LO1: Understand concept of data models
LO2 : Understand the models of spatial information
• Field based model
• Object based model
LO3: Understand the 3-step design of databases
LO4: Learn about the trends in spatial data models
f g : x f ( x) g ( x)
f g : x f ( g ( x))
Types of Field Operations
Local: value of the new field at a given location in the spatial frame-work
depends only on the value of the input field at that location(e.g.,
Thresholding)
Focal:value of the resulting field at a given location depends on the values
that the input field assumes in a small neighborhood of the location(e.g.,
Gradient)
Zonal:Zonal operations are naturally associated with aggregate operators or
the integration function. An operation that calculates the average height of the
trees for each species is a zonal operation.
Green is A interior ( Ao )
U
Red is boundary of A (A)
Concept Symbol
Entities
Attributes
Multi-valued Attributes
Relationships
Cardinality of Relationship 1:1, M:1, M:N
ER Diagram for “State-Park”
Fig 2.4
•Exercise:
•List the entities, attributes, relationships in this ER diagram
•Identify cardinality constraint for each relationship.
•How many roads “Accesses” a “Forest_stand”? (one or many)
2.2.2 Logical Data Model: The Relational Model
Relational model is based on set theory
Main concepts
Domain: a set of values for a simple attribute
Relation: cross-product of a set of domains
• Represents a table, i.e. homogeneous collection of rows (tuples)
• The set of columns (i.e. attributes) are same for each row
Comparison to concepts in conceptual data model
Relations are similar to but not identical to entities
Domains are similar to attributes
Translation rules establishing exact correspondence are discussed in 2.2.3
Relational Schema
Schema of a Relation
Enumerates columns, identifies primary key and foreign keys.
Primary Key :
• one or more attributes uniquely identify each row within a table
Foreign keys
• R’s attributes which form primary key of another relation S
• Value of a foreign key in any tuple of R match values in some row of S
Relational schema of a database
collection of schemas of all relations in the database
Example: Figure 2.5 (next slide)
Ablue print summary drawing of the database table structures
Allows analysis of storage costs, data redundancy, querying capabilities
Some databases were designed as relational schema in 1980s
Nowadays, databases are designed as E R models and relational schema is
generated via CASE tools
Relational Schema Example
•Exercise:
•Identify relations with
•primary keys
•foreign keys
•other attributes
•Compare with ER diagram
•Figure 2.4, pp. 37
Fig 2.5
Relational Schema for “Point”, “Line”, “Polygon” and “Elevation”
Fig 2.5
More on Relational Model
Integrity Constraints
Key: Every relation has a primary key.
Entity Integrity: Value of primary key in a row is never undefined
Referential Integrity: Value of an attribute of a Foreign Key must appear as a value
in the primary key of another relationship or must be null.
Fig 2.7
Specifying Pictograms
•Grammar based approach
•Rewrite rule
•like English syntax diagrams
•Classes of pictograms
•Entity pictograms
•basic: point, line, polygon
•collection of basic
•...
•Relationship pictograms
•partition, network
Entity Pictograms: Basic shapes, Collections
Entity Pictograms: Derived and Alternate Shapes
•Derived shape example is city center point from boundary polygon
•Alternate shape example: A road is represented as a polygon for construction
•or as a line for navigation
2.4 Conceptual Data Modeling with UML
•Motivation
•ER Model does not allow user defined operations
•Object oriented software development uses UML
•UML stands for Unified Modeling Language
•It is a standard consisting of several diagrams
•class diagrams are most relevant for data modeling
•UML class diagrams concepts
•Attributes are simple or composite properties
•Methods represent operations, functions and procedures
•Class is a collection of attributes and methods
•Relationship relate classes
•Example UML class diagram: Figure 2.8
UML Class Diagram with Pictograms: Example
•Exercise: Identify classes, attributes, methods, relationships in Fig. 2.8.
•Compare Fig. 2.8 with corresponding ER diagram in Fig. 2.7.
Fig 2.8
Comparing UML Class Diagrams to ER Diagrams
•Concepts in UML class diagram vs. those in ER diagrams
•Class without methods is an Entity
•Attributes are common in both models
•UML does not have key attributes and integrity constraints
• ERD does not have methods
•Relationships properties are richer in ERDs
•Entities in ER diagram relate to datasets, but UML class diagram
•can contain classes which have little to do with data
2.5 Summary
Spatial Information modeling can be classed into Field
based and Object based
Field based for modeling smoothly varying entities, like
rainfall
Object based for modeling discrete entities, like country
Summary
A data model is a high level description of the data
it can help in early analysis of storage cost, data quality
There are two popular models of spatial information
Field based and Object based
Database are designed in 3-steps
Conceptual, Logical and Physical
Pictograms can simplify Conceptual data models