Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne...
-
Upload
alban-bradley -
Category
Documents
-
view
227 -
download
0
Transcript of Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne...
![Page 1: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/1.jpg)
Spatial DatabasesSpatial DatabasesDT249,DT211,DT228 DT249,DT211,DT228 Semester 2 Semester 2
2012-132012-13
Lecture 0Lecture 0
Pat BrownePat Browne
http://www.comp.dit.ie/pbrowne/Spatial%20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm
![Page 2: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/2.jpg)
Your Interest in Spatial Databases Your Interest in Spatial Databases Jobs in GISJobs in GIS
GovernmentGovernment Most major departments are developing GIS on an ongoing Most major departments are developing GIS on an ongoing
basis: e.g. the Geological Survey of Ireland (GSI), Environment basis: e.g. the Geological Survey of Ireland (GSI), Environment Protection Agency (EPA), Duchas, OPW.Protection Agency (EPA), Duchas, OPW.
Semi-statesSemi-states Many agencies have a big investment in GIS e.g. ESB.Many agencies have a big investment in GIS e.g. ESB.
Local AuthoritiesLocal Authorities County councils run many GIS applications.County councils run many GIS applications.
Private SectorPrivate Sector MAPFLOW, IMGS (Information with location).MAPFLOW, IMGS (Information with location).
Post graduate research: Post graduate research: DIT Digital Media Centre (DMC), DIT Digital Media Centre (DMC), The National Centre for The National Centre for
Geocomputation (Maynooth).Geocomputation (Maynooth).
![Page 3: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/3.jpg)
Fingal CC Fix our streetFingal CC Fix our street
http://www.fixyourstreet.ie/
![Page 4: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/4.jpg)
Your Interest in Spatial Databases Your Interest in Spatial Databases Technically Interesting Technically Interesting
Spatial databases provided the essential Spatial databases provided the essential logiclogic and and structurestructure for a host useful and interesting applications for a host useful and interesting applications (e.g. emergency services routing, hospital placement, (e.g. emergency services routing, hospital placement, game environments). game environments).
This spatial database course brings together many This spatial database course brings together many topics that you have already studied (e.g. databases, topics that you have already studied (e.g. databases, graphics, objection orientation, statistics) and applies graphics, objection orientation, statistics) and applies them in innovative ways.them in innovative ways.
Spatial databases can answer a range of questions from Spatial databases can answer a range of questions from ““where is the nearest chipper?where is the nearest chipper?” to “How does ” to “How does Sellafield Sellafield effect the Irish east coast?effect the Irish east coast?”.”.
Spatial database work with many other Spatial database work with many other technologies (e.g. Internet ,wireless networks, technologies (e.g. Internet ,wireless networks, and GPS.)and GPS.)
![Page 5: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/5.jpg)
What is a Spatial Database?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).
![Page 6: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/6.jpg)
Tables or layers of dataTables or layers of data11
![Page 7: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/7.jpg)
Why Spatial Databases? Queries to databases are posed in high level declarative Queries to databases are posed in high level declarative
manner (usually using SQL)manner (usually using SQL)
SQL is popular in the commercial database world.SQL is popular in the commercial database world.
Standard SQL operates on relatively simple data types.Standard SQL operates on relatively simple data types.
SQL3/OGISSQL3/OGIS11 supports several spatial data types and supports several spatial data types and operations. We will study the Open Geospatial operations. We will study the Open Geospatial Consortium Simple Features for SQL.Consortium Simple Features for SQL.
Additional spatial data types and operations can be Additional spatial data types and operations can be defined in spatial database. (CREATE TYPE statement)defined in spatial database. (CREATE TYPE statement)
A DBMS is a way of storing information in a manner that A DBMS is a way of storing information in a manner that enforces consistency, enforces consistency, facilitates access, facilitates access, Allows users to relate data from multiple tables togetherAllows users to relate data from multiple tables together
![Page 8: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/8.jpg)
Spatial Databases must integrate Spatial Databases must integrate with other applications and data.with other applications and data.
Map Renderer
Network
Wireless Mobile
Devices
HTML Viewer Java Viewer GIS Desktop
Applications
Custom Applications
Spatial DB
(Internet)
Server Side Applications
![Page 9: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/9.jpg)
Spatial enabled DB SummarySpatial enabled DB Summary
Database – an integrated set of data on a Database – an integrated set of data on a particular subject. Can include spatial and non-particular subject. Can include spatial and non-spatial and temporal data.spatial and temporal data.
Databases offer many advantages over files.Databases offer many advantages over files. Relational databases dominate for non-spatial Relational databases dominate for non-spatial
use, Object-relational database (ORDBMS) are use, Object-relational database (ORDBMS) are used for spatial data.used for spatial data.
Databases address some limitations for Databases address some limitations for specialist or dedicated GIS.specialist or dedicated GIS.
![Page 10: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/10.jpg)
Query 1Query 1
““Display all counties that Display all counties that borderborder Kildare”. Kildare”. This query can be implemented using the This query can be implemented using the
following SQL command:following SQL command:select c1.name as select c1.name as name,transform(c1.the_geom,4326) as the_geomname,transform(c1.the_geom,4326) as the_geom
from county c1,county c2from county c1,county c2
wherewhere
touches(c1.the_geom,c2.the_geom)touches(c1.the_geom,c2.the_geom)
andand
c2.name='Kildare';c2.name='Kildare';
![Page 11: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/11.jpg)
Result 1Result 1
![Page 12: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/12.jpg)
Query 2Query 2 “ “Display all regional roads that Display all regional roads that intersectintersect the N7 National Primary Road within the the N7 National Primary Road within the
region of Dublin Belgard” This query can be implemented using the following SQL region of Dublin Belgard” This query can be implemented using the following SQL command:command:
SELECT asbinary(r.the_geom), r.class AS nameFROM regional AS r,roads n,county AS cWHEREn.class='N7'AND c.name='Dublin Belgard'ANDintersects(n.the_geom,r.the_geom)ANDcontains(c.the_geom,intersection(r.the_geom,n.the_geom));
![Page 13: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/13.jpg)
Result 2Result 2
Results in red
![Page 14: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/14.jpg)
Querying moving objectsQuerying moving objects
Find where and when will it snow givenFind where and when will it snow given Clouds(X, Y, Time, humidity) Clouds(X, Y, Time, humidity) Region(X, Y, Time, temperature) Region(X, Y, Time, temperature)
(SELECT(SELECT x, y, time x, y, time FROM CloudsFROM Clouds
WHERE humidity >= 80)WHERE humidity >= 80) INTERSECTINTERSECT
(SELECT x, y, time(SELECT x, y, time FROM RegionFROM Region WHERE temperature <= 32)WHERE temperature <= 32)
![Page 15: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/15.jpg)
Example QueryExample Query
““How many people live within 5 miles How many people live within 5 miles of the toxic gas leak?”of the toxic gas leak?”
SELECT sum(population) SELECT sum(population) FROM census_info FROM census_info WHERE WHERE distance(census_geom,’POINT(…)’) < 5 distance(census_geom,’POINT(…)’) < 5
Toxic leak in Well Known Text (WKT) format
![Page 16: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/16.jpg)
Example QueryExample Query
““What is the combined area of all parks What is the combined area of all parks insideinside the Dublin postal district 1?” the Dublin postal district 1?”
SELECT sum(area(park_geom)) SELECT sum(area(park_geom)) FROM parks, postalDistrict FROM parks, postalDistrict WHERE WHERE contains(postalDistrict_geom,park_geom) contains(postalDistrict_geom,park_geom) ANDAND
postalDistrict_name = ‘Dublin 1’postalDistrict_name = ‘Dublin 1’
Based on lecture from Paul Ramsey Refractions Research
![Page 17: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/17.jpg)
![Page 18: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/18.jpg)
Visualization of Information
Population1
![Page 19: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/19.jpg)
Example QueryExample Query
What is the maximum distance a student What is the maximum distance a student has to travel to school?”has to travel to school?”
SELECT SELECT max(distance( max(distance( student_location, school_location student_location, school_location )) )) FROM students, schoolsFROM students, schools
Based on lecture from Paul Ramsey Refractions Research
![Page 20: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/20.jpg)
NetworkingNetworking
For enhanced network traversal and For enhanced network traversal and routing PostgreSQL/PostGIS can be routing PostgreSQL/PostGIS can be extended with pgRouting software which extended with pgRouting software which can perform:can perform: Shortest path search (with 3 different Shortest path search (with 3 different
algorithms)algorithms) Traveling Salesperson Problem solution Traveling Salesperson Problem solution
(TSP)(TSP) Driving distance geometry calculationDriving distance geometry calculation
http://pgrouting.postlbs.org/
![Page 21: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/21.jpg)
Querying a non-spatial attributeQuerying 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.
![Page 22: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/22.jpg)
Formalizing Common SenseFormalizing Common Sense
It helps minimize the ambiguity in data if it It helps minimize the ambiguity in data if it is properly formalized with respect to the is properly formalized with respect to the real world. The following pair of signs are real world. The following pair of signs are displayed at the foot of an escalator. What displayed at the foot of an escalator. What do they mean? They have exactly the do they mean? They have exactly the grammatical structure.grammatical structure.
Shoes
Must Be
Worn
Dogs
Must Be
Carried
![Page 23: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/23.jpg)
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.
![Page 24: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/24.jpg)
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 geo-referencing. Maps can be used as representation of the world and of information. We focus on topological, geometric, and thematic information.
![Page 25: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/25.jpg)
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)
![Page 26: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/26.jpg)
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.
![Page 27: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/27.jpg)
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.
![Page 28: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/28.jpg)
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 object-oriented 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, R-statistical package, ArgoCaseGEO, uDIG, OpenJump, GeoServer, Openlayers.
![Page 29: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/29.jpg)
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.
![Page 30: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/30.jpg)
Main Topics
Spatial database systems: PostgreSQL-Spatial database systems: PostgreSQL-PostGIS.PostGIS.
OGC OGC “Simple Features for SQL”“Simple Features for SQL” Spatial statistics; spatial RSpatial statistics; spatial R Geographic data on the web (e.g. Geographic data on the web (e.g.
Geoserver, Open Layers, Open Street Geoserver, Open Layers, Open Street Map, WMS,WFS,WPS)Map, WMS,WFS,WPS)
Spatial systems in a social and economic Spatial systems in a social and economic context.context.
![Page 31: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/31.jpg)
Geographic Markup languageGeographic Markup languageGMLGML
GML can be loaded, saved and viewed using OpenJump
![Page 32: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/32.jpg)
OGC Well Known TextOGC Well Known Text
http://en.wikipedia.org/wiki/Well-known_text
![Page 33: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/33.jpg)
Main References
Spatial Databases: With Application to GIS Rigaux, Scholl, Voisard
http://ukcatalogue.oup.com/product/9780199554324.do#.UQkL1GeFng0/
http://www.pragprog.com/titles/sdgis/gis-for-web-developersGIS: A Computing Perspective
http://www.manning.com/obe/
http://www.spatial.cs.umn.edu/Book/
![Page 34: Spatial Databases DT249,DT211,DT228 Semester 2 2012-13 Lecture 0 Pat Browne 20Databases%20SDEV4005/Spatial%20Databases%20SDEV4005.htm.](https://reader035.fdocuments.net/reader035/viewer/2022062300/56649d9d5503460f94a85f8e/html5/thumbnails/34.jpg)
SoftwareSoftware PostgreSQLPostgreSQL PostGISPostGIS pgRoutingpgRouting Open JumpOpen Jump GeoserverGeoserver R LanguageR Language A little Google Maps, Java, & JavaScriptA little Google Maps, Java, & JavaScript Data from: Ordnance Survey Ireland, Open Street Data from: Ordnance Survey Ireland, Open Street
Map (OSM), Central Statistics Office (CSO)Map (OSM), Central Statistics Office (CSO)