Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
DATABASE SPASIAL DENGAN
POSTGRESQL
GALIH WASIS WICAKSONO
TEKNIK INFORMATIKA UMM
PENGANTAR
PostGIS adalah extensi spasial untuk
PostgreSQL
PostGIS bertujuan untuk menjadikan OpenGIS
menjadi fitur yang mudah dan sederhana bagi
SQL dalam database spasial.
TUJUAN POSTGIS
Database spasial yang Open source
Database dengan fitur spasial sangat mahal ex
oracle
Memiliki banyak fitur – fitur/fungsi spasial
Mengembangkan fungsi spasial cukup sulit.
Mendukung fungsi spasial untuk berbagai tujuan.
Mendukung organisasi informasi, visualisasi, dan
analisa spasial.
MODEL DATA SPASIAL
Jalan direpresentasikan dengan garis
kotak surat direpresentasikan dengan titik.
MODEL DATA SPASIAL
Landuse direpresentasikan poligon
MODEL DATA SPASIAL
Kombinasi data spasial (point, line, poligon)
RELASI SPASIAL
DISTANCE
DISTANCE TO VARIOUS POINT
KEDEKATAN / ADJACENCY
KONEKTIVITAS
CONTAINMENT/KANDUNGAN
CONTAINMENT & ADJACENCY
PENGGUNAAN DB SPASIAL
Geocodable addresses
Weather Information
Customer location
Land holdings
Store locations
Natural resources
Transportation tracking
City Planning
Statistical/Demographic
Environmental planning
Cartography
Information Visualization
Epidemiology
Hazard detection
Crime patterns
KEUNTUNGAN DB SPASIAL
Dapat memperlakukan data spasial dengan
model apapun dalam database :
transactions
backups
integrity checks
less data redundancy
fundamental organization and operations handled by
the Database
multi-user support
security/access control
locking
KEUNTUNGAN DB SPASIAL
Mengatasi tugas – tugas besar dari db server
organisasi dan indexing
tidak perlu re-implementasi bagi operator
tidak perlu re-implementasi bagi fungsi
Waktu yang dibutuhkan untuk mengembangkan
aplikasi database disisi client lebih mudah
KEUNTUNGAN DB SPASIAL
Query spasial untuk relasi
distance
adjacency
containment
Query spasial untuk operator
area
length
intersection
union
buffer
QUERY OPERATOR SPASIAL
Original Polygons
Union
Intersection
QUERY OPERATOR SPASIAL
Buffered rivers
Original river network
CONTOH SQL
Membuat table pubs
create table pubs
name varchar,beer_price float4);
addgeometrycolumn(‘beer_db’,'pubs','lo
cation’,2167,'POINT',3);
CONTOH SQL
Insert data
insert into pubs values(
'Garricks Head‘,
4.50,
GeometryFromText(
'POINT(1196131 383324)’,
2167
)
);
CONTOH SQL
Insert data
PERFORM QUERY
select name, beer_price, distance(location,
GeometryFromText('POINT(1195722 383854)',2167))
from pubs order by beer_price;
name
| beer_price |
distance
---------------+------------+-----------------Fireside
|
4.25 | 1484.10275160491
The Forge
|
4.33 | 1533.06561109862
Rumours
|
4.46 | 2042.00094093097
Garricks Head |
4.5 | 669.389105609889
Slap Happy
|
4.5 | 1882.31910168298
Old Bailys
|
4.55 | 1147.20900404641
Black Sheep
|
4.66 | 536.859935972633
Big Bad Daves |
4.75 | 907.446543878884
PERFORM QUERY
select name, beer_price + 0.001 *
distance(location,
GeometryFromText('POINT(1195722 383854)',2167))
as net_price from pubs order by price;
name
|
net_price
---------------+-----------------Garricks Head | 5.16938910560989
Black Sheep
| 5.19685978338474
Big Bad Daves | 5.65744654387888
Old Bailys
| 5.69720919478127
Fireside
| 5.73410275160491
The Forge
| 5.86306553480468
Slap Happy
| 6.38231910168298
Rumours
| 6.50200097907794