Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Lecture 3 Spatial Databases

Lecture 3 covers the fundamentals of spatial databases, including concepts, design, and management of databases, specifically focusing on spatial and attribute data. It discusses the advantages and disadvantages of databases compared to file-based datasets, various database models, and the importance of normalization in database design. Additionally, it explains basic table operations such as joins and relates, emphasizing their application in GIS.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lecture 3 Spatial Databases

Lecture 3 covers the fundamentals of spatial databases, including concepts, design, and management of databases, specifically focusing on spatial and attribute data. It discusses the advantages and disadvantages of databases compared to file-based datasets, various database models, and the importance of normalization in database design. Additionally, it explains basic table operations such as joins and relates, emphasizing their application in GIS.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 71

Lecture 3: Spatial Databases

OUTLINE
Fundamentals of Databases and Attributes
•Database Concepts
•Database Design and Management
•Database Models
•Spatial and Attribute Data
•Basic Table Operations
•Attribute and Spatial Data Query
Database
Concepts
Introduction
Computing
Paradigms

Deposit Retrieve

Users

FILE PROCESSING DATABASE


APPROACH APPROACH
Definitions
• Database – an integrated set of data (attributes) on a particular
subject; collection of interrelated tables in a digital format with
controlled redundancy to optimally serve one or more applications
• Geographic (=spatial) database - database containing geographic data
of a particular subject for a particular area
• Database Management System (DBMS) – software to create,
maintain and access databases
Significance of Database
• Most GIS activities consist of storing spatial entity and attribute data
so that we can retrieve any combination of these objects.
• Each graphical feature must be stored explicitly with its attributes so
that their combined search becomes faster.
Advantages of Databases over File-
based Datasets
•Avoids redundancy and duplication
•Reduces data maintenance costs
•Faster for large datasets
•Applications are separated from the data
•Applications persist over time
•Support multiple concurrent applications
•Better data sharing
•Security and standards can be defined and enforced
Disadvantages of Databases over File-
based Datasets
• Expense
• Complexity
• Performance – especially complex data types
• Integration with other systems can be difficult at times
Database Table Example

Figure 1: A simple – and flawed – table design.

Figure 2: An improved database table..


Database
Management
Role of
DBMS
Syste Geographi Task • Data load
• Editing
m c s • Visualizati
Informatio on
n System • Mapping
• Analysis
Database • Storage
Manageme • Indexing
nt System • Security
• Query

Dat
a
UP Department of Geodetic Engineering
Training Center for Applied Geodesy and
Photogrammetry
Spatial and
Attribute Data
REVIEW:
A GIS links attribute and spatial data

• Attribute Data • Map Data


•Flat File or DBMS •Point File
•Relationships •Line File
•Topology Table •Area File
•Topology Type
Spatial and Attribute Data in GIS
•GIS involves both spatial and
attribute data.
Spatial – location and
geometry of map
features
 Attribute – characteristics of the
map features, stored in tables
Spatial and Attribute Data in GIS
•Raster data
•Each cell can “own” only a
single value
•Multi-attribute data will be
represented by several
raster maps 3 3 3 3 3 1 1 1 1 1

•Each raster map will have 3 3 3 3 3 1 1 1 1 1


3 3 3 3 3 1 1 1 1 1
an individual
3 3 3 3 2 2 2 2 2 2
attribute table 3 3 3 2 2 2 2 2 2 2
3 3 2 2 2 2 2 2 2 2
3 3 2 2 2 2 2 2 2 2

Attribute
Data
Spatial and Attribute Data in GIS
•Vector data
•Multiple attributes may be
contained in a single
table, if mapping units
remain the same.
•However, table may ID Area Site Owner Date Cost
become too large and 1
unwieldy, and 2
difficult to update as 3

a result. 4
5
6
Spatial and Attribute
Data in GIS
Column = attribute
Sample
Attribute
Table
Row = object

Vector feature
Spatial and Attribute Data in GIS

Databa
se
•Integrated set of data on a particular subject
•Collection of interrelated data stored together with
controlled redundancy to optimally serve one or
more applications
Database
Models
Common Types of DBMS Model
•Flat file
•Hierarchical
•Network
•Relational -
RDBMS
Flat
file
• Contains all the data in a large table
• Spreadsheet

Parcel ID Owner Zoning

P101 Cruz Residential (1)

P101 Valdez Residential (1)

P102 Lopez Commercial (2)

P102 Jimenez Commercial (2)

P103 Carillo Commercial (2)

P104 Lopez Residential (1)


Hierarchical
• Organizes data at different levels and uses one-to-many association
between levels.

Zoning

1 2

P101 P104 P102 P103

Cruz Valdez Lopez Lopez Jimenez Carillo


Network
• Builds connection across tables

Zoning Owner

1 2 Cruz Valdez Lopez Jimenez Carillo

P101 P102 P103 P104


Relational
• A collection of tables or relations that can be connected to each other
by keys.
• Primary key: one or more attributes whose values can uniquely identify a record
in a table.
• Foreign key: counterpart in another table for the purpose of linkage.

 Table – data about a class of


Zoning Owner
objects
🞑 Two-dimensional list (array)
🞑 Rows = objects
Parcel 🞑 Columns = properties,
attributes
Relational Database
Table A
Name Address Parcel #
John Smith 18 Lawyers Dr. 756554
T. Brown 14 Summers Tr. 887419

Table B
Parcel # Assessed Value
887419 152,000
446397 100,000
Relational DBMS
•Most popular type of DBMS
•Over 95% of data in DBMS is in RDBMS

•Most popular DBMS model for GIS

•Flexible approach to linkages between records


comes the closest to modeling the complexity
of spatial relationships between objects.
Relational Databases
Advantages of Relational DB
•Each table in the DB can be prepared, maintained,
and edited separately from other tables

•The tables can remain separate until a query or an


analysis requires that attribute data from
different tables be linked together
Relational DBMS
•Commercial
systems
•IBM DB2
•Informix
•Microsoft Access
•Microsoft SQL Server
•Oracle
•Sybase
Database Design: Basics
•Determine the entities involved and create
a separate table for each type of entity
(thing, concept, event, theme) and
name it.
•Determine the relationships among the
entities
•Determine the Primary Key for each table.
•Determine the properties for each entity (the
non- key attributes).
Entity-Relationship (E-R) Model
• Entity type: an abstraction that represents a collection of similar
objects, about which the system is going to contain information
• Attribute types: properties that describe entities

Name
town Population
Centroid
• How is one entity related to another entity?
E-R Diagram
• Which roads lie on which towns?
Road_id

Class • Relationship types:


road
Start_point • Many-to-many (M-N)
• One-to-one (1-1)
M End_point • One-to-many (1-M) / Many-to-one
(M-1)
lies_on

N Name

town Population

Centroid
Types of Relationships
(Cardinalities)
• Relationship between tables (records in tables)

or M-1 (many to one)


E-R
Diagram
name
road_id
birth_year
name staff
gender
roads class
M address
start point
M TIN
end point
works
lies on
1 name
N
area
1 1
towns have town hall address

bldg type

town_id name population


Normalization
•A process of decomposition, taking a table with all the
attribute data and breaking it down into small tables while
maintaining the necessary linkages between them (Vetter
1987)
•A series of steps followed to obtain a database design that
allows for consistent storage and efficient access of data in a
relational database.
Original
Table

Student Advisor Adv-Room Class1 Class2 Class3


#

1022 Jones 412 101-07 143-01 159-02

4123 Smith 216 201-01 211-02 214-01

From Microsoft Knowledge Base Article - 209534


First Normal Form
Tables
Student# Advisor Adv-Room Class#

1022 Jones 412 101-07

1022 Jones 412 143-01

1022 Jones 412 159-02

4123 Smith 216 201-01

4123 Smith 216 211-02

4123 Smith 216 214-01

From Microsoft Knowledge Base Article - 209534


Second Normal
Form
Eliminate Redundant Data
Students: Registration:

Student Class#
Student Advisor Adv-Room #
# 1022 101-07
1022 Jones 412 1022 143-01
4123 Smith 216 1022 159-02
4123 211-01
4123 211-02
4123 214-01
From Microsoft Knowledge Base Article - 209534
Third Normal
Form
Eliminate Data Not Dependent On Key
Students:
Registration:
Student Advisor Student Class#
# #
1022 Jones 1022 101-07
1022 143-01
4123 Smith
1022 159-02
Faculty:
4123 211-01
Name Room
4123 211-02
Jones 412
4123 214-01
Smith 216
From Microsoft Knowledge Base Article - 209534
Ex: Database Normalization (1)

•Sample Student Activities DB Table


•Poorly Designed
•Non-unique records
• John Smith
•Test the Design by developing sample reports and
queries
Ex: Database Normalization (2)
•Created a unique “ID”
for each Record in
the Activities Table
•Required the creation of
an “ID” look-up table
for reporting (Students
Table)
•Converted the “Flat-
File” into a
Relational
Database
Ex: Database
Normalization (3)
•Wasted Space
•Redundant data entry
•What about taking a
3rd Activity?
•Query Difficulties - trying
to find all swimmers
•Data Inconsistencies -
conflicting prices
Ex: Database
Normalization (4)
•Students table is fine
•Elimination of two
columns and an
Activities Table
restructuring, Simplifies
the Table
•BUT, we still have
Redundant data (activity
fees) and data
insertion anomalies. Problem: If student #219 transfers, we
lose all references to Golf and its price.
Ex: Database Normalization (5)
•Modify the Design to
ensure that “every non-key
field is dependent on the
whole key”
•Creation of the
Participants Table, corrects
our problems and forms
a union between 2
tables.

This is a Better Design!


When Not to Normalize a
Database
•Relates in large tables require large amounts
of computer time to process.
•If you have an application that speed is more important
than database structure.
•If you are creating a very simple data base that
will be used for a short time and then discarded.
Basic Table Operations: Joins and
Relates
•Joins
•Brings together 2 tables by using a common field or a
primary key and a foreign key
•E.g. Join attribute data from one or more non-spatial data
tables to a feature attribute table
•Recommended for:
• One-to-one relationship
• Many-to-one relationship
•Inappropriate for one-to-many
Basic Table Operations: Joins and
Relates Record ID Brand Year
1241 Ford 2003
Recor
Address #cars 1241 Subaru 2000
d ID
1241 Honda 1999
1241 123 State St. 3
1242 Kia 2002
1242 1801 Main St. 1
1243 2106 Elm St. 2
Record Addres Bran Yea
1244 7262 Pine Drive 1 ID s d r
124 123 State For 200
1 St. d 3
124 123 State Subar 200
1 St. u 0
124 123 State Hond 199
1 St. a 9
124 1801 Main Ki 200
2 St. a 2
Basic Table Operations: Joins and
Relates
• Relates
•Link
•Temporarily connects two tables but keeps the tables
physically separate
•Advantage: appropriate for all 4 types of relationships
•Disadvantage: Tends to slow down data access (especially
remote)
Basic Table Operations: Joins and
Relates
•Relates
•Tables are also linked using common row/ column values
or keys but does not result to a new table.
Types of relationships
•One-to-One Join
•Many-to-One Join
•One-to-Many Relate
•Many-to-Many Relate
One-to-One Join
Employee-id Job Employee-id Name
1 Digislave 1 Tom
2 Useless Supervisor 2 John

Join Employee-id to Employee-id

After join

Employee-id Job Name

1 Digislave Tom

2 Useless Supervisor John

A join does not permanently alter the table structure


Many-to-One Join
Polygon Id Symbol
Symbol Description
1 Qa
Qa Quaternary Alluvium
2 Qa
Qe Quaternary Eolian
3 Pa
Pa Permian Abo
4 Qe

After Join on Symbol


Polygon ID Symbol Description

1 Qa Quaternary
Alluvium
2 Qa Quaternary
Alluvium
3 Pa Permian Abo

4 Qe Quaternary Eolian
One-to-Many Relates
Symbol Mineral

Formation Symbol Qa Quartz


Quaternary Alluvium Qa Pa Quartz
Permian Abo Pa
Qa Gypsum

Pa Feldspar

If the tables are related on Symbol selecting Polygon-id 1 will select


the highlighted areas.
Many-to-Many Relates
Symbol Mineral

Formation Symbol Qa Quartz


1 Qa Pa Quartz
2 Qa
Qa Gypsum

Pa Feldspar

If the tables are related on Symbol selecting Polygon-id 1 or 2 will


both select the highlighted areas.
Attribute and Spatial
Data Query
ATTRIBUTES AND SPATIAL
DATA QUERY
A. ATTRIBUTE DATA ENTRY
oField definition
oAttribute data verification
oCreation of new attribute data
B. QUERYING
oAttribute querying
oTypes of GIS Query
oGIS Operations
ATTRIBUTES AND SPATIAL DATA
QUERY
A. Attribute Data Entry
•Akin to digitizing for spatial data entry
•Attribute data need to be entered by typing
•Given: map with 2,000 polygons and
10 fields
•Time: At 10 seconds per value, it takes 55
hours – 33 minutes – 20 seconds (2.3 days)
to enter 20,000 values
•Best to determine if an organization has
attribute data in digital format (e.g. NSO)
ATTRIBUTES AND SPATIAL DATA
QUERY
A. Attribute Data Entry
Field Definition:
•Definition of fields
(a) field name
(b) data type*
(c) data width
(d) number of decimal places.
*Data type may be (a) numeric (integer or
floating-point), (b) string, (c) Boolean, or (d) date.
•Consider measurement scale of data.
Types of Attribute Data
•By Data Type
•Number, text, date, binary large object (BLOB)
•BLOBs store images, multimedia, and feature
geometrics as long sequences of binary
numbers.
•By Measurement Scale
•Nominal
CATEGORICAL DATA
data
•Ordinal data
NUMERICAL DATA
•Interval data
•Ratio data
Geodatabase Field Data
Types
• NUMBERS

• Users specify the precision, which is the maximum length of the field, and scale,
which is the maximum number of decimal places.

• TEXT - A text field represents a series of alphanumeric symbols.

• DATES - The date data type can store dates, times, or dates and times. The
default format in which the information is presented is mm/dd/yyyy
hh:mm:ss and a specification of AM or PM.
Geodatabase Field Data
Types
• BLOBs - simply some data stored in the geodatabase as a long sequence of
binary numbers.

• Object Identifiers - maintained by ArcGIS and guarantees a unique ID for each


row in the table (OID, FID)

• Global Identifiers - store registry style strings consisting of 36 characters


enclosed in curly brackets to uniquely identify a feature or table row within
a geodatabase and across geodatabases (Global ID, GUID)

• Geometry - the geometry data type indicates the type of geometry—point,


line, polygon, multipoint, or multipatch—the table stores (SHAPE)
ATTRIBUTES AND SPATIAL DATA
QUERY
A. Attribute Data Entry
Attribute Data Verification:
• To check for errors:
Table may be printed for manual verification
Computer programs may be written to automate task

ERRORS IN ATTRIBUTE DATA INPUT


• Attribute error
 Using the wrong code for an attribute
 Misspellings
 Missing attributes
 Incorrect attribute values
• Entity-attribute agreement (logical consistency) error
•Correct code is linked to the wrong entity
ATTRIBUTES AND SPATIAL DATA
QUERY
A. Attribute Data Entry

Creation of New Attribute Data:


•Attribute data classification
•Example: Elevation
High = {Higher than 600 meters}
Medium = {Between 200 and 600 meters}
Low = {Lower than 200 meters”
ATTRIBUTES AND SPATIAL DATA
QUERY
A. Attribute Data Entry

Creation of New Attribute Data:


•Attribute data computation
Example:
1. Soil erosion potential =
rainfall parameter ×
Soil parameter
× topographic
parameter × land cover
parameter ×
management parameter

2. Agricultural harvest =
ATTRIBUTES AND SPATIAL DATA
QUERY
B. QUERYING

•Method of data retrieval


•Can be performed either on data that are part
of the GIS database or on new data produced as
a result of data analysis
ATTRIBUTES AND
AL DATA
SPATI QUERY
B. QUERYING
 Attribute querying
permits:
⚫ Selection of specific entities
or classes
⚫ Filtering of data using the
Boolean operators
⚫ Arithmetic functions to
compute new values
⚫ Statistical functions, sorting
and organizing
UP Department of Geodetic Engineering
Training Center for Applied Geodesy and
Photogrammetry
ATTRIBUTES AND SPATIAL DATA
QUERY
 Many GIS queries can be
B. performed by querying the
QUERYING attribute database of a GIS.
ATTRIBUTES AND SPATIAL DATA
QUERY
B. QUERYING
Two Types of Query Aspatial Query
for GIS • Questions
about the
attributes of
features
• Example: “How
many elementary
schools are there?”
ATTRIBUTES AND SPATIAL DATA
QUERY Spatial Query
B. QUERYING • Requires
Two Types of Query information about
for GIS the location of a
feature
• Example: “Where
in Cagayan are
elementary schools
located?”
ATTRIBUTES AND SPATIAL DATA
QUERY
B. QUERYING

Combined Querying
• Individual queries can be combined to identify features that satisfy
two or more spatial and/or aspatial criteria
•Example: “Where are the municipalities in Camiguin
which
have a population greater than 5000?”
• Usually uses Boolean operators (and, or, not)
•Example: “What are the schools located in
Surigao with student population greater than 1000?

You might also like