Database: Spatial Data GIS Database
Database: Spatial Data GIS Database
Database
Contour
Soil
Spatial Data
GIS Database
Landuse
Agriculture Census
Soil Type
Contour Heights Non Spatial
data
1
02-08-2015
Definition
• Vector
X,Y X,Y
X,Y
X,Y X,Y X,Y
X,Y
• Raster
Column
Row
• Data has
Behavior rules
Geometry
Attributes
1-4
2
02-08-2015
primary
roads
Single linear
highways
feature class
“Roads”
secondary
roads
FID = 5052
Feature Identifier
5-6
3
02-08-2015
Coverage
Shapefile Geodatabase
Internet Map
CAD Service
Raster Tables
QGIS/
ArcGIS
5-7
• Shapefile
– Single feature class
– Attributes stored in dBASE table
– Made up of separate files
– Can create and edit with ArcGIS or ArcView 3.x
• Use only ArcCatalog to manage
shapefiles in arcgis
• Qgis explorer can handle shape files
5-8
4
02-08-2015
• Coverage
– Multiple feature classes
– Attributes stored in INFO table
– Can only be stored in an ArcGIS Workspace
– Edited only with ArcInfo Workstation
• Use only ArcCatalog to manage coverages
5-9
Shape field
accesses read-only
coordinates
5-10
5
02-08-2015
Attributes Database
Metadata
6
02-08-2015
Terms in Database
7
02-08-2015
DATABASE MANAGEMENT
SYSTEM
• Hierarchical Database Management System
• Network Database Management System
• Object Oriented Database Management System
• Relational Database Management System
KTM KTM
8
02-08-2015
Hierarchical database
• A hierarchical database organizes data as one object of interest related to many
other objects of interest. The tree-like structure. produced is referred to as an
ordered set of parent/child relationships. In this model, a parent can have one or
more children. Child cannot have more than one parent. When real world’ data
relationships are of this type, the hierarchical model is an effective representation
model.
• Hierarchical are familiar relationships. Examples are plant and animal
taxonomies, a dendritic river drainage pattern, and the organization of a file
cabinet into several drawers, each of which contains a number of folders which
may contain one or more documents, and so on. Note that the relationship is
always from one to many; the model does not support from many to one.
• The hierarchical model includes an implementation strategy that requires the
extensive use of physical pointers. These pointers become part of the data
structure and are therefore explicit. That is, the relationships that are believed to
exist become hard-wired into the implementation. This may make a hierarchical
database very efficient in processing data demonstrating such a relationship, but
very difficult to process data which does not conform
• Network database extend the hierarchical model and allow from many to one
relationships to be represented. Street patterns, shown in the graphic above, illustrate
networks. When modelled in this way, many streets can be associated with one
intersection. The network and the hierarchical model makes extensive use of physical
pointers to identify relationships. Because of the requirements to traverse the
database along physical pointers, hierarchical and network databases have an
embedded implementation scheme.
• The network model is very effective in management of geographic information,
especially for establishing linear features and their relationships
9
02-08-2015
Landuse
• In this model the data re arranged in classes and sub-classes, which are a set of
objects grouped into categories and with link of various kinds. All objects in the
same class share a set of properties (attribute) and methods (requests)
• The above diagram is normally termed as object model diagram, which illustrates
relationships among classes. The diagram depicts inheritance type of relationship.
Inheritance relationships illustrate the Is Kind Of relationship and allow for a
progressive refinement of classes from the more general to the more specific.
Super-classes define more general aspects which subclasses inherit and further
define additional more specific characteristics and behavior. When looking for a
particular request or attribute, search the class and then also the super-classes.
• The categories inherit hierarchically the properties and methods of the class in the
preceding rank. For example, a deciduous forest sub-class will inherit the
properties and methods of the forest class.
The principles of object-oriented databases are aimed at overcoming some of the
disadvantages f classic structured (in particular the layer based system). The
object-oriented programming make use of the above concept. Typically, behave a
format like this: Object .Request
10
02-08-2015
Relational Database
11
02-08-2015
12
02-08-2015
Field
Sort:
Alice Tolentino, 71 Rizal St, Concepcion, Marikina, 5050011
Gwen Cruz, 253 Alice St, Greenhills, San Juan, 4992122
James Del Sol, 9 Jay St, Concepcion, Marikina, 4893892
Robert Santos, 100 Rosal St, Rosario, Pasig, 2298310
13
02-08-2015
• Revision of Design
Cruz, Gwen, 253 Alice St, Greenhills, San Juan, 4992122
Del Sol, James, 9 Jay St, Concepcion, Marikina, 4893892
Santos, Robert, 100 Rosal St, Rosario, Pasig, 2298310
Tolentino, Alice, 71 Rizal St, Concepcion, Marikina, 5050011
From
name, address, phone number
To
last name, first name, street address, municipality, phone number
14
02-08-2015
Multi-table Database
• Each of the tables will be linked to one or more of the other tables
• Multi-file databases like this are called relational databases
• Relational databases are made up of two or more tables of
information which are connected in some way.
Customer
Primary key CustomerID FirstName LastName Address Birthday
1 Robert Santos Rosario, Pasig 9/15/1980
2 Gwen Cruz Greenhills, San Juan 2/28/1985
3 James Del Sol Concepcion, Marikina 5/1/2000
Order
CustomerID Item Quantity Price
1 Shoes 1 2,950.00
Foreign key
2 Blouse 1 849.00
1 Belt 1 499.00
3 Wrist Watch 1 1,999.00
Database Indexing
15
02-08-2015
16
02-08-2015
Customer Item
• one-to-many CustomerID ItemID
Name Name
Item Description
Quantity UnitPrice
Price
17
02-08-2015
18
02-08-2015
Costumer Table
Product Detail Table
Order_ID CustmerID EmployeeID
Item_
Product_ID Product_Name Price 10000 Ram 6
Saving cream 10001 Syam 8
104 zelate 68
10002 Gopi 3
108 Nescafe 106
10003 Hari 3
122 Panasonic Radio 111
110 Freeze samsung 32000
Order_ID Product_ID quantity
Order Detail Table 10001 104 3
10001 108 19
10001 122 2
10003 104 10
Summary Table 10003 110 5
19
02-08-2015
What is Normalization?
• Normalization is the process of efficiently organizing data in a
database. There are two goals of the normalization process:
eliminating redundant data (for example, storing the same data in
more than one table) and ensuring data dependencies make
sense (only storing related data in a table). Both of these are
worthy goals as they reduce the amount of space a database
consumes and ensure that data is logically stored.
• The database community has developed a series of guidelines for
ensuring that databases are normalized. These are referred to as
normal forms and are numbered from one (the lowest form of
normalization, referred to as first normal form or 1NF) through five
(fifth normal form or 5NF). In practical applications, you'll often see
1NF, 2NF, and 3NF along with the occasional 4NF. Fifth normal
form is very rarely seen.
20
02-08-2015
Normalization contd
Customer
CustomerID* FirstName LastName Address Birthday
1 Robert Santos Rosario, Pasig 9/15/1980
2 Gwen Cruz Greenhills, San Juan 2/28/1985
3 James Del Sol Concepcion, Marikina 5/1/2000
Order
CustomerID Item Quantity Price
1 Shoes 1 2,950.00
2 Blouse 1 849.00
1 Belt 1 499.00
3 Wrist Watch 1 1,999.00
• First normal form (1NF) sets the very basic rules for an organized
database: Eliminate duplicative columns from the same table.
• Create separate tables for each group of related data and identify
each row with a unique column or set of columns (the primary key).
• First Normal Form (1NF): A table is 1NF if every cell contains a
single value, not a list of values.
Normalization
Customer
CustomerID* FirstName LastName Address Birthday
1 Robert Santos Rosario, Pasig 9/15/1980
2 Gwen Cruz Greenhills, San Juan 2/28/1985
3 James Del Sol Concepcion, Marikina 5/1/2000
21
02-08-2015
• Third normal form (3NF) goes one large step further: Meet all the
requirements of the second normal form.
• Remove columns that are not dependent upon the primary key
(the non-key columns are independent of each other)
Integrity Rules
Customer
CustomerID* FirstName LastName Address Birthday
1 Robert Santos Rosario, Pasig 9/15/1980
2 Gwen Cruz Greenhills, San Juan 2/28/1985
3 James Del Sol Concepcion, Marikina 5/1/2000
22
02-08-2015
Integrity Rules
Customer
CustomerID* FirstName LastName Address Birthday
1 Robert Santos Rosario, Pasig 9/15/1980
2 Gwen Cruz Greenhills, San Juan 2/28/1985
3 James Del Sol Concepcion, Marikina 5/1/2000
Order
CustomerID Item Quantity Price
1 Shoes 1 2,950.00
2 Blouse 1 849.00
1 Belt 1 499.00
3 Wrist Watch 1 1,999.00
Integrity Rules
23
02-08-2015
Column Indexing
Activities Table
Athlete Activity1 Cost1 Activity2 Cost2
Robert Santos Tennis 3,600 Swimming 1,700
Problem? Gwen Cruz Weightlifting 1,000 Swimming 1,700
Robert Santos Tennis 3,600
James Del Sol Swimming 1,500 Golf 4,700
24
02-08-2015
25
02-08-2015
Step 7 & 8: Modify the design and test sample data- Eliminate the
Activity 2 and Cost 2 fields
Athletes Table Activities Table
Athlete ID* ID* Activity Cost
Robert Santos 8 8 Swimming 1,700
Gwen Cruz 10 8 Tennis 3,600
Robert Santos 18 10 Weightlifting 4,000
James Del Sol 21 10 Swimming 1,700
18 Tennis 3,600
21 Golf 4,700
21 Swimming 1,500
21 Weightlifting 4,000
26
02-08-2015
27
02-08-2015
Exercise
Condition:
28
02-08-2015
29
02-08-2015
SQL
• SQL is an industry standard database query language used to
fetch records from tables and to present those records with the
fields desired. SQL may also be used to create new tables by
combining existing tables, and may even be used to alter the
structure of the database and the data it contains.
• Select queries show results in tables and always begin with
the SQL word select. Select queries choose data from one or
more tables and display it in tabular form. Select queries do
not change any data in the tables.
SELECT * FROM PARCELS WHERE PROPCLASS =
210
• Action queries do not display data but rather perform a task
when they are run. Action queries change data in existing
tables by appending, updating or deleting records. Action
queries can also create new tables. Action queries start with
words other than select. For example, an update query starts
with the word Update.
UPDATE PARCELS SET PROPCLASS = 210
SQL
30
02-08-2015
31