Lecture 0 - School of Computing
Download
Report
Transcript Lecture 0 - School of Computing
Spatial Databases
DT249,DT211,DT228 Semester 2
2015-16
Lecture 0
Pat Browne
http://www.comp.dit.ie/pbrowne/Spatial%20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm
Your Interest in Spatial Databases
Jobs in GIS
Government
Most major departments are developing GIS on an ongoing
basis: e.g. the Geological Survey of Ireland (GSI), Environment
Protection Agency (EPA), Duchas, OPW.
Semi-states
Many agencies have a big investment in GIS e.g. ESB.
Local Authorities
County councils run many GIS applications.
Private Sector
MAPFLOW, IMGS (Information with location).
Post graduate research:
DIT Digital Media Centre (DMC), The National Centre for
Geocomputation (Maynooth).
Fingal CC Fix our street
http://www.fixyourstreet.ie/
Your Interest in Spatial Databases
Technically Interesting
Spatial databases provided the essential logic and
structure for a host useful and interesting applications
(e.g. emergency services routing, hospital placement,
game environments).
This spatial database course brings together many
topics that you have already studied (e.g. databases,
graphics, objection orientation, statistics) and applies
them in innovative ways.
Spatial databases can answer a range of questions from
“where is the nearest chipper?” to “How does Sellafield
effect the Irish east coast?”.
Spatial database work with many other
technologies (e.g. Internet ,wireless networks,
and GPS.)
What is a Spatial Database?
A spatial database is a database system (DBMS)
that is optimized to store and query basic spatial
objects e.g.:
Point: a house, a moving car
Line: a road segment, road network
Polygon: a county, voting area
Which are usually augmented with spatial
relations, thematic information, and temporal
information, all expressed in a declarative way
using a appropriate languages (e.g. SQL+spatial
extensions).
Tables or layers of data1
Why Spatial Databases?
Queries to databases are posed in high level declarative
manner (usually using SQL)
SQL is popular in the commercial database world.
Standard SQL operates on relatively simple data types.
SQL3/OGIS1 supports several spatial data types and
operations. We will study the Open Geospatial
Consortium Simple Features for SQL.
Additional spatial data types and operations can be
defined in spatial database. (CREATE TYPE statement)
A DBMS is a way of storing information in a manner that
enforces consistency,
facilitates access,
Allows users to relate data from multiple tables together
Spatial Databases must integrate
with other applications and data.
HTML Viewer
Java Viewer
(Internet)
GIS Desktop
Applications
Wireless
Mobile
Devices
Network
Custom
Applications
Map Renderer
Spatial
DB
Server Side
Applications
Spatial enabled DB Summary
Database – an integrated set of data on a
particular subject. Can include spatial and nonspatial and temporal data.
Databases offer many advantages over files.
Relational databases dominate for non-spatial
use, Object-relational database (ORDBMS) are
used for spatial data.
Databases address some limitations for
specialist or dedicated GIS.
Query 1
“Display all counties that border Kildare”.
This query can be implemented using the
following SQL command:
select c1.name as
name,transform(c1.the_geom,4326) as the_geom
from county c1,county c2
where
touches(c1.the_geom,c2.the_geom)
and
c2.name='Kildare';
Result 1
Query 2
“Display all regional roads that intersect the N7 National Primary Road within the
region of Dublin Belgard” This query can be implemented using the following SQL
command:
SELECT asbinary(r.the_geom), r.class AS name
FROM regional AS r,roads n,county AS c
WHERE
n.class='N7'
AND
c.name='Dublin Belgard'
AND
intersects(n.the_geom,r.the_geom)
AND
contains(c.the_geom,intersection(r.the_geom,n.the_geom));
Result 2
Results in red
Example Query
“How many people live within 5 miles
of the toxic gas leak?”
SELECT sum(population)
FROM census_info
WHERE
distance(census_geom,’POINT(…)’) < 5
Toxic leak in Well Known Text (WKT) format
Example Query
“What is the combined area of all parks
inside the Dublin postal district 1?”
SELECT sum(area(park_geom))
FROM parks, postalDistrict
WHERE
contains(postalDistrict_geom,park_geom)
AND
postalDistrict_name = ‘Dublin 1’
Based on lecture from Paul Ramsey Refractions Research
Example Query
What is the maximum distance a student
has to travel to school?”
SELECT
max(distance(
student_location, school_location
))
FROM students, schools
Based on lecture from Paul Ramsey Refractions Research
Networking
For enhanced network traversal and
routing PostgreSQL/PostGIS can be
extended with pgRouting software which
can perform:
Shortest path search (with 3 different
algorithms)
Traveling Salesperson Problem solution
(TSP)
Driving distance geometry calculation
http://pgrouting.postlbs.org/
Querying a non-spatial attribute
Find the countries of western Europe with population greater than 50
million. This is a projection on the attribute population. Unlike a
conventional database query we often want the query result and the
original context, in this case Europe.
Formalizing Common Sense
It helps minimize the ambiguity in data if it
is properly formalized with respect to the
real world. The following pair of signs are
displayed at the foot of an escalator. What
do they mean? They have exactly the
grammatical structure.
Shoes
Dogs
Must Be
Must Be
Worn
Carried
Course Overview
This course focuses on the use of database
management systems (DBMS) to store spatial
information. A spatially enabled DBMS is a
central component of a Geographical
Information System (GIS). GIS has a major role
to play in managing the national physical and
informational infrastructure. An understanding of
spatially enabled DBMS is vital in implementing
any information system where geographic data
is required. This course focuses on the role of
the DBMS in geographical applications.
Course Description 1
Foundations Fundamental geographic
concepts for GIS The world in spatial terms, how
natural and man made features can be stored in
a DBMS. We can have qualitative and
quantitative location e.g. address and coordinate
systems. These can be related using georeferencing. Maps can be used as
representation of the world and of information.
We focus on topological, geometric, and
thematic information.
Course Description 2
Algorithms for GIS: Intersection of lines,
operations on polygons, network traversal,
auto-correlation, statistical operations,
searching. We focus on the use of
algorithms, not their design. The actual
algorithms are provided as database
extensions (e.g. PostGIS) or desktop GIS
(e.g. OpenJump or uDig)
Course Description 3
Spatial representations: Raster, vector,
TIN, quadtrees, R-trees, scan orders,
polygon coverage, discrete objects,
networks, time, connections and topology,
networks, distance and direction, flow and
diffusion, spatial hierarchies, boundaries,
spatial patterns, attributes of relationships.
As with the algorithms the actual
representations are provided by the DBMS
extensions (via APIs) and GIS.
Course Description 4
Applications of geospatial data:
Transportation networks, natural
resources, soil data, oceanography, land
cover, geology, climate, terrain, land
records, administrative boundary data,
demographic studies, decision support
and health data.
Course Description 5
Spatial databases Spatial data: definitions,
formats, models, queries the relational model,
advanced SQL, data modelling techniques,
implementing a simple database, post relational
database models, object-relational and objectoriented models, spatial data structures, spatial
indexing e.g. R-Tree, networking, database
issues in GIS. The course will involve practical
work on a range of appropriate software e.g.
PostgreSQL/PostGIS, MLPQ/Presto, Rstatistical package, ArgoCaseGEO, uDIG,
OpenJump, GeoServer, Openlayers.
Learning Outcomes
On completion of the spatial database module,
you will be able to:
Use a database to store and query spatial data
Understand spatial modelling techniques.
Develop applications that use a spatially enabled
DBMS
Understand and use the OGC standards GML,
SFSQL1, WMS, WFS, WPS.
Distinguish and use appropriate database models
Understand the DBMS extensions and APIs required
by application programs to handle spatial data.
Main Topics
Spatial database systems: PostgreSQL
PostGIS.
OGC “Simple Features for SQL”
Spatial statistics; spatial R
Geographic data on the web (e.g.
Geoserver, Open Layers, Open Street
Map, WMS,WFS,WPS)
Spatial systems in a social and economic
context.
Geographic Markup language
GML
GML can be loaded, saved and viewed using OpenJump
OGC Well Known Text
http://en.wikipedia.org/wiki/Well-known_text
Main References
http://www.spatial.cs.umn.edu/Book/
http://www.manning.com/obe/
Spatial Databases:
With Application to GIS
Rigaux, Scholl, Voisard
http://ukcatalogue.oup.com/product/9780199554324.do#.UQkL1GeFng0/
GIS: A Computing Perspective
http://www.pragprog.com/titles/sdgis/gis-for-web-developers
Software
PostgreSQL
PostGIS
pgRouting
Open Jump
Geoserver
R Language
A little Google Maps, Java, & JavaScript
Data from: Ordnance Survey Ireland,
Open Street Map (OSM), Central Statistics