Professional Documents
Culture Documents
1
Why are databases important ?
2
Database of Elements-at-risk are useful in describing a population
center, prioritization of actions and projects
3
A database is a structured collection of data. The data are
typically organized to model relevant aspects of reality
source: wikipedia
4
RISK DATABASES are listings of locations and pertinent information of
buildings and critical structures that may be exposed to hazards
In REDAS, risk elements are classified as:
POINTS
-particular spots
LINES
POINTS
LINES
-for linear features
POLYGONS
- for areas
POLYGONS
5
Previous REDAS User_Database
6
REDAS New_User_Database (~2012)
• Uses SQLite
• Non Server
Based;
• Portable
(easy to build;
not secured)
• User-Built
Database;
• Spatial
extension
(SPATIALITE)
7
SQLite and Spatialite
SQLite – relational database
management system
8
Run REDAS
REDAS_2.8k
9
Tools
Run REDAS
SQLITE Module
10
The REDAS SQLite database module allows user to create
database (db), its tables and create and execute
commands
11
Three main parts of the REDAS Sqlite module
1 2 3
12
Upon opening REDAS SQLite module, a default database
(buildings.db) will automatically open. It has only one table
named “barangays”
13
Column Names – Should be All Capital, no spaces must be used
14
Commands/scripts are displayed in this space
15
Familiarization with Sqlite
buttons and functions
16
1. FILE
LOAD DATABASE
EXIT
17
REDAS and its New_User_database folders
Regional Metro_Manila Province
(National Data)
db db db
Regional
(National Data)
db
Points
19
X
db
- Original db file
- Source is the barangay centroid
data from NSO (2007)
20
1b. Regional Folder
• Barangays.db
- (duplicate of Buildings.db found
in Regional/points)
• Regional_exposure.db
- Consists of tables of regional
(national) point data (schools,
hospitals,churches, bridges, etc)
21
2. Metro_Manila folder
Metro_Manila.db
pdf Reports db
PHOTOS
Grid files Raster plot files Points
Unit_ID
Important:
plot files Polygons
• PHOTOS should be
inside Points folder
Annotations
• UNIT_ID should be
inside PHOTOS folder mapfiles Mapfiles
• Each PC has its own
UNIT_ID geotiff,jpg,bmp Imageries
23
2. TOOLS
Open New SQLITE Window
Open 3rd Party SQLITE Browser
Open Spatialite Gui
Open Spatialite Scripting Window
CREATE NEW DATABASE
CREATE TABLE
Export Data
Import Data
24
2a. You can also duplicate windows by clicking
TOOLS
Open New SQLITE Window
25
2b. You can open the SQLite Browser by clicking
TOOLS
Open 3rd Party SQLITE Browser
26
2c. You can open the Spatialite GUI by clicking
TOOLS
27
2d. You can open the Spatialite GUI by clicking
TOOLS
Open Spatialite Scripting Window
28
2e. Create new database by clicking:
TOOLS
CREATE NEW
DATABASE (db)
29
2f. Create new table by clicking:
TOOLS
CREATE TABLE
30
3. HELP
SQLITE MANUAL
SPATIALITE MANUAL
SPATIALITE TUTORIAL
31
3a. Viewing of SQLite Manual by clicking
HELP
SQLITE MANUAL
32
3b. Viewing of Spatialite Manual by clicking
HELP
SPATIALITE
MANUAL
33
3c. Viewing of Spatialite Tutorial by clicking
HELP
SPATIALITE
TUTORIAL
34
4. DATABASE NAME(Sample:buildings.db)
35
5. TABLE NAME (Sample table: barangays)
36
6. Show All (Shows all the contents of the database)
37
7a. Column for Sorting
38
7b. Comparator
39
Comparators, in-depth
40
7c. Sorting Value
41
7d. SORT (Sorts data you want to view)
42
Data_ID = 2 will appear
43
8a. To plot point data, click the “Column Name for
Plot File” and choose the column name you want to
plot).
44
8b. To plot, click “SHOW POINT PLOT FILE” button. A four-
column database will appear.
8c. followed by the “SAVE POINT PLOT FILE” button
45
8. Then Save the point plot file in
C:\REDAS\NEW_USER_DATABASE\REGIONAL\PO
INTS\barangays_plot.dat
46
The file will scroll down to signify processing.
47
Risk data plotting menu, select point data
48
C:\REDAS\New_User_Database\Regional\Points\
barangays_plot.dat
49
Point Data PlottingInstructions: 50
Reason: dataset is
too large
51
Query Points
52
Note: When displaying risk data, REDAS
plots only the risk data in the last selected
geographical coordinates used
54
9. Display Photo (1,2,3,4) & DISPLAY PDF
55
10. EXECUTE SQL SCRIPT & View log File
56
11. EXPORT AS CSV & IMPORT A CSV FILE
57
Advanced SQLite Queries
58
12a. Always click “Show All” as a preparatory step to
sorting
59
12b. Reminders
61
13b. Check by clicking column for sorting, “like”
comparator and “Santa Maria” as sorting value
62
13c. Click Sort.
63
13d. Result
64
14a. Creating a new table from a sorted data
65
14b. Click Show All, then set the sorting values
66
14c. Sort
67
14d. Result
68
14f. To create a Table of your selected data, type on
the SQL Script box the command Create Table
Presentacion_Barangays as
and place it before the existing script.
70
14h. Confirm Command Successful by clicking ok.
71
14i. To update table list, click “Refresh Database”
72
14j. Newly-created tables are shown as the latest in
the list and is found in the lowest part of the list
73
14k. Select the table and check its contents
74
14l. Results
75
15a. Selecting Barangays by their Names from a
given table
77
15c. Execute the SQL Script.
78
15d. Results are as shown.
79
16a. Selecting Barangays in a given Municipality
Can be
select * from barangays generated
using sorting
where MUNICIPALITY_CITY like menu
‘%Presentacion%’
and Can be
(BARANGAY_NAME like ‘%Santa Maria%’ copied
from log
or BARANGAY_NAME like ‘%Lagha%’) file
80
16b. Click EXECUTE SQL SCRIPT
82
16c. Results are as shown.
83
17. Displaying counts
85