Lecture 3: Spatial Data Management Dr. Taysir Hassan Abdel Hamid Associate Professor, Information Systems Dept., Faculty of Computers and Information.

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

Chapter 3:Spatial Query Languages 3
The Role of Error Map and attribute data errors are the data producer's responsibility, GIS user must understand error. Accuracy and precision of map and.
Spatial Query Languages Standard Database Query Languages.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
GI Systems and Science January 30, Points to Cover  Recap of what we covered so far  A concept of database Database Management System (DBMS) 
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
Introduction to Spatial Analysis
GTECH 201 Lecture 05 Storing Spatial Data. Leftovers from Last Session From data models to data structures Chrisman’s spheres ANSI Sparc The role of GIScience.
Geographic Information Systems
WFM 6202: Remote Sensing and GIS in Water Management
©2005 Austin Troy Lecture 9: Introduction to GIS 1.Vector Geoprocessing Lecture by Austin Troy, University of Vermont.
Dr. David Liu Objectives  Understand what a GIS is  Understand how a GIS functions  Spatial data representation  GIS application.
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. – Creating new polygon features through.
Microsoft Access 2010 Chapter 7 Using SQL.
Intro. To GIS Lecture 6 Spatial Analysis April 8th, 2013
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. Perform spatial analysis and modeling.
Intro. To GIS Lecture 4 Data: data storage, creation & editing
Basic Spatial Analysis
United Nations Regional Seminar on Census Data Dissemination and Spatial Analysis Bangkok, Thailand, 5-8 October, 2010 Building a Geographic Database and.
Preparing Data for Analysis and Analyzing Spatial Data/ Geoprocessing Class 11 GISG 110.
Spatial Database Souhad Daraghma.
GIS2: Geo-processing and Metadata Treg Christopher.
Spatial Query Language Group No.15 Dhruv Dhokalia Yash Khandelwal Course Relation- Chapter 11- Object and Object-Relational Databases.
United Nations Regional Seminar on Census Data Dissemination and Spatial Analysis Amman, Jordan, May, 2011 Spatial Analysis & Dissemination of Census.
GIS 1 GIS Lecture 4 Geodatabases. GIS 2 Outline Administrative Data Example Data Tables Data Joins Common Datasets Spatial Joins ArcCatalog Geodatabases.
Applied Cartography and Introduction to GIS GEOG 2017 EL
Quick Lesson on Databases Relational databases are key to managing complex data You’ve been using relational databases with “Joins” and “Relates” in ArcGIS.
SQL and SSQL IT4GIS Keith T. Weber, GISP GIS Director, ISU.
 Trace the incremental algorithm for constructing convex data on the sample point data given below. Intermediate steps should be shown First, two steps.
GIS Tutorial 1 Lecture 4 Geodatabases. Outline  Data types  Geodatabases  Data table joins  Spatial joins  Field calculator  Calculate geometry.
Concepts of Database Management Seventh Edition
Spatial Query Languages Standard Database Query Languages.
Introduction to GeoDatabase Lecture
University of Palestine Faculty of Applied Engineering and Urban Planning GIS Course Spatial Analysis Eng. Osama Dawoud 1 st Semester 2009/2010.
Chapter 3:Spatial Query Languages 3.1 Standard Database Query Languages 3.2 Relational Algebra 3.3 Basic SQL Primer 3.4 Extending SQL for Spatial Data.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
1 Spatial Data Models and Structure. 2 Part 1: Basic Geographic Concepts Real world -> Digital Environment –GIS data represent a simplified view of physical.
Creating and Maintaining Geographic Databases. Outline Definitions Characteristics of DBMS Types of database Relational model SQL Spatial databases.
Map overlays & Geoprocessing Learn about spatial analysis functions overlays, clipping & buffering Use overlays to analyze multiple spatial criteria Understand.
Spatial DBMS Spatial Database Management Systems.
Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language.
Nhóm thực hiện: nhóm 1 Nguyễn Ngọc Trường Trần Minh Khang Bùi Quốc Huy Nguyễn Ngọc Linh Nguyễn Thành Phương Trần.
NR 143 Study Overview: part 1 By Austin Troy University of Vermont Using GIS-- Introduction to GIS.
Intro to GIS | Summer 2012 Attribute Tables – Part 1.
1 Agenda Today Due: topic of your term project Quiz with two questions Spatial query language Next class.
Lecture 10 Creating and Maintaining Geographic Databases Longley et al., Ch. 10, through section 10.4.
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
Definition of Spatial Analysis
Introduction to Geographic Information Systems Fall 2013 (INF 385T-28620) Dr. David Arctur Research Fellow, Adjunct Faculty University of Texas at Austin.
WFM 6202: Remote Sensing and GIS in Water Management © Dr. Akm Saiful IslamDr. Akm Saiful Islam WFM 6202: Remote Sensing and GIS in Water Management Dr.
CENTENNIAL COLLEGE SCHOOL OF ENGINEERING & APPLIED SCIENCE VS 361 Introduction to GIS SPATIAL OPERATIONS COURSE NOTES 1.
Lecture 10: Geoprocessing with Python (II) Dr. Taysir Hassan Abdel Hamid Associate Professor, Information Systems Dept., Faculty of Computers and Information.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Spatial Query Languages
Key Terms Attribute join Target table Join table Spatial join.
Spatial Query Languages
Vector Analysis Ming-Chun Lee.
Physical Structure of GDB
Spatial Analysis & Dissemination of Census Data
Basic Spatial Analysis
Geographic Information Systems
Spatial Data Processing
ISU-GIS Training and Research Center
URBDP 422 Urban and Regional Geo-Spatial Analysis
Spatial Analysis & Dissemination of Census Data
GIS Lecture: Geoprocessing
Vector Geoprocessing.
Presentation transcript:

Lecture 3: Spatial Data Management Dr. Taysir Hassan Abdel Hamid Associate Professor, Information Systems Dept., Faculty of Computers and Information Assiut University March 6, 2016

Outline Geodatabases Spatial relationships Spatial queries

A Spatial Database A spatial database is a database that is optimized to store and query data that is related to objects in space, including points, lines and polygons.database While typical databases can understand various numeric and character types of data, additional functionality needs to be added for databases to process spatial data types. These are typically called geometry or feature. The Open Geospatial Consortium created the Simple Features specification and sets standards for adding spatial functionality to database systems Open Geospatial ConsortiumSimple Features

Geodatabases Definition: The geodatabase is a collection of geographic datasets of various types. An ArcGIS geodatabase is a collection of geographic datasets of various types held in a common file system folder, a Microsoft Access database, or a multiuser relational database (such as Oracle, Microsoft SQL Server, PostgreSQL, Informix, or IBM DB2).

Fundamental Datasets in the Geodatabase A key geodatabase concept is the dataset. It is the primary mechanism used to organize and use geographic information in ArcGIS. The geodatabase contains three primary dataset types: – Feature classes – Raster datasets – Tables

Datasets Types in GeoDatabases File Geodatabase - Stored as folders in a file system. Each dataset is held as a file that can scale up to 1 TB in size. The file geodatabase is recommended over personal geodatabases. Personal geodatabases - All datasets are stored within a Microsoft Access data file, which is limited in size to 2 GB Enterprise geodatabases – unlimited number of users, Stored in a relational database using Oracle, Microsoft SQL Server, IBM DB2, IBM Informix, or PostgreSQL.

Spatial relationships logical connections between spatial objects represented by points, lines and polygons e.g., - point-in-polygon - line-line - polygon-polygon

Spatial relationships “adjacent to” “connected to” “near to” “intersects with” “within” “overlaps” etc.

Spatial relationships Some relationships are stored in a topological data model - “adjacent to” right poly and left poly in the line attribute table - “connected to” list of lines that share the same node in the node attribute table others need to be computed

“is nearest to” point/point - which family planning clinic is closest to the village? point/line - which road is nearest to the village same with other combinations of spatial features

“is nearest to”: Thiessen polygons

“is near to”: buffer operations point buffer - affected area around a polluting facility - catchment area of a water source

buffer operations line buffer - how many people live near the polluted river? - what is the area impacted by highway noise?

buffer operations polygon buffer - area around a reservoir where development should not be permitted

“crosses”: line intersection when traveling to the dispensary, do farmers have to cross this river?

“is within”: point in polygon which of the cholera cases are within the contaminated water catchment area?

General overlay types Identity – spatial join or point-in-polygon Clip – similar to set extent when using raster data Intersection Buffer ( for all of the above, operations are on layers, not single polygons )

Spatial Overlay Analysis: A type of analysis in which data is extracted from one layer (such as block groups) to an overlay layer (such as a trade area). Overlay is one of the most common and powerful GIS functions. It investigates the spatial association of features by “vertically stacking” feature layers to investigate geographic patterns and determine locations that meet specific criteria.

Spatial Join Point in polygon operation – which points are in the Polygon? Polygon ID (id_1) is added to the point layer’s attribute table.

Clip A B ABC Two polygons, A and B, Overlap. Clip A using B as a cookie cutter. Clip operation creates a new polygon, C, which is the intersect, or overlap, of A and B. Attributes of A do not appear in C.

Creating subsets create a subset of a data set using another incompatible set “cookie-cutting” A B C A A B C inputclip coveroutput

Intersect A B ABC Two polygons, A nd B, Overlap. Find the Intersection of A using B. Intersect operation creates a new polygon, C, which is the intersection, or overlap, of A and B. Attributes of A and B do appear in C.

Buffer Buffers are polygon shapes that surround a feature by a uniform distance. Buffers can be created around points, lines, and polygons. Buffers don’t share the attributes of the feature that they surround. Use spatial Joins to add the attributes.

Point in a Polygon

An ER Example World Database

Conceptual Model –3 Entities: Country, City, River –2 Relationships: capital-of, originates-in 3 Relations –Country(Name, Cont, Pop, GDP, Life-Exp, Shape) –City(Name, Country, Pop,Capital, Shape) –River(Name, Origin, Length, Shape) Keys Primary keys are Country.Name, City.Name, River.Name Foreign keys are River.Origin, City.Country Data for 3 tables

World database data tables

Populating Tables in SQL Adding a row to an existing table “INSERT INTO” statement Specifies table name, attribute names and values Example: INSERT INTO River(Name, Origin, Length) VALUES(‘Nile River’, ‘Habasha’, 6,6500) Related statements SELECT statement with INTO clause can insert multiple rows in a table DELETE statement removes rows UPDATE statement can change values within selected rows

World database data tables

SELECT Example 1. Simplest Query has SELECT and FROM clauses Query: List all the cities and the country they belong to. SELECT Name, Country FROM CITY Result 

SELECT Example 2. Query: List the names of the capital cities in the CITY table. SELECT * FROM CITY WHERE CAPITAL=‘Y ’ Result 

SQL Example 3 Query: List the attributes of countries in the Country relation where the life-expectancy is less than seventy years. SELECT Co.Name,Co.Life-Exp FROM Country Co WHERE Co.Life-Exp <70 Note: use of alias ‘Co’ for Table ‘Country’ Result 

SQL Example 4: Multi-table Query Query: List the capital cities and populations of countries whose GDP exceeds one trillion dollars. Note:Tables City and Country are joined by matching “City.Country = Country.Name”. SELECT Ci.Name,Co.Pop FROM City Ci,Country Co WHERE Ci.Country =Co.Name AND Co.GDP > AND Ci.Capital=‘Y ’

SQL Example 5: Aggregate Staistics Query: What is the average population of the noncapital cities listed in the City table? SELECT AVG(Ci.Pop) FROM City Ci WHERE Ci.Capital=‘N ’ Query: For each continent, find the average GDP. SELECT Co.Cont,Avg(Co.GDP)AS Continent-GDP FROM Country Co GROUP BY Co.Cont

SQL Example 6 Query: For each country in which at least two rivers originate, find the length of the smallest river. SELECT R.Origin, MIN (R.length) AS Min-length FROM River GROUP BY R.Origin HAVING COUNT (*) > 1

Spatial Operations with SQL Topological and Set comparison Operations Equal: True if the interior and boundary of two geometries are equal. Disjoint: True if the boundaries and interiors do not intersect Intersection: true if geometries are not disjoint Touch: true if the boundaries of two surfaces intersect but their interiors do not Cross: true if the interior of a surface intersects with a curve. Within: returns true if the interior of a given geometry does not intersect with the exterior of another geometry Contains: tests whether the given geometry contains another given geometry. Overlap: returns true if the interiors of two geometries have non-empty intersecrtions.

Spatial Operations with SQL Spatial Analysis Distance: return the shortest distance between to geometries Buffer: returns zone around some geometries Intersection: Returns the intersection of two geometries Union: Returns the union of two geometries Difference: returns the portion of a geometry that does not intersect with another given geometry. SymmDif: returns the portions of two geometry that do not intersect with each other.

World database data tables

Using Spatial Operation in WHERE clause Query: Find the names of all countries which are neighbors of the United States (USA) in the Country table. SELECT C1.Name AS "Neighbors of USA" FROM Country C1,Country C2 WHERE Touch (C1.Shape,C2.Shape)=1 AND C2.Name =‘USA ’ Note: Spatial operator Touch() is used in WHERE clause to join Country table with itself. This query is an example of spatial self join operation.

Using spatial operator Distance Query: List the GDP and the distance of a country’s capital city to the equator for all countries. SELECT Co.GDP, Distance (Point(0,Ci.Shape.y),Ci.Shape) AS "Distance" FROM Country Co,City Ci WHERE Co.Name = Ci.Country AND Ci.Capital =‘Y ’

Spatial Query with multiple tables Query: For all the rivers listed in the River table, find the countries through which they pass. SELECT R.Name, C.Name FROM River R, Country C WHERE Cross (R.Shape,C.Shape)=1 Note: Spatial operation “Cross” is used to join River and Country tables. This query represents a spatial join operation.

buffer operations line buffer - how many people live near the polluted river? - what is the area impacted by highway noise?

Using spatial operation in an aggregate query Query: List all countries, ordered by number of neighboring countries. SELECT Co.Name, Count(Co1.Name) FROM Country Co, Country Co1 WHERE Touch (Co.Shape,Co1.Shape) GROUP BY Co.Name ORDER BY Count (Co1.Name) Notes: This query can be used to differentiate querying capabilities of simple GIS software (e.g. Arc/View) and a spatial database. It is quite tedious to carry out this query in GIS.

Nested Spatial Query Query: List the countries with only one neighboring country. A country is a neighbor of another country if their land masses share a boundary. According to this definition, island countries, like Iceland, have no neighbors. SELECT Co.Name FROM Country Co WHERE Co.Name IN (SELECT Co.Name FROM Country Co,Country Co1 WHERE Touch (Co.Shape,Co1.Shape) GROUP BY Co.Name HAVING Count(*)=1) Note: It shows a complex nested query with aggregate operations. Such queries can be written into two expression, namely a view definition, and a query on the view. The inner query becomes a view and outer query is run on the view. This is illustrated in the next slide.

Basic Functions