Chapter 5 Queries.

Slides:



Advertisements
Similar presentations
Chapter 4 Part C: Queries, Computations & Map Algebra.
Advertisements

Object Relational Model Spatial Queries. Query Model Spatial Layer Data Table where coordinates are stored Primary Filter Spatial Index Index retrieves.
NSF DUE ; Module 4.3. NSF DUE ; GeoTEd Partners Module name and number.
Geographic Information Systems Applications in Natural Resource Management Chapter 8 Combining and Splitting Landscape Features, and Merging GIS Databases.
From portions of Chapter 8, 9, 10, &11. Real world is complex. GIS is used model reality. The GIS models then enable us to ask questions of the data by.
Data Storage and Processing GIS Topics and Applications.
Geodatabase basic. The geodatabase The geodatabase is a collection of geographic datasets of various types used in ArcGIS and managed in either a file.
Week 7. Feature relationship and topology Oct. 17 th, 2005.
1 CIS / Introduction to Business GIS Winter 2005 Lecture 2 Dr. David Gadish.
Intro. To GIS Lecture 6 Spatial Analysis April 8th, 2013
Basic Spatial Analysis
IFS Intro. to Data Management Chapter 6 Filtering your data.
Attributes & Queries Reading Assignment: Bolstad, Ch. 8 (p )
GIS Concepts ‣ What is a table? What is a table? ‣ Queries on tables Queries on tables ‣ Joining and relating tables Joining and relating tables ‣ Summary.
Attribute Data in GIS Data in GIS are stored as features AND tabular info Tabular information can be associated with features OR Tabular data may NOT be.
Introduction to ArcGIS for Environmental Scientists Module 2 – Fundamentals Chapter 7 – Queries.
School of Geography FACULTY OF ENVIRONMENT Introduction to ArcToolbox and Geoprocessing.
Creating Your Own Data ArcView_module_13 May 16, 9:00 AM.
GIS 1 GIS Lecture 4 Geodatabases Copyright – Kristen S. Kurland, Carnegie Mellon University.
Data Queries Selecting features in ArcMap Data queries  Important part of a GIS project Can be a part of your data preparation or final analysis  Data.
Copyright © 2006 by Maribeth H. Price 5-1 Chapter 5 Working with Tables.
Instructor: Craig Duckett Lecture 08: Thursday, October 22 nd, 2015 Patterns, Order of Evaluation, Concatenation, Substrings, Trim, Position 1 BIT275:
Queries Select by Attribute Select by Location. What is a Query? A query extracts information from a data table for further use –Once extracted you can:
Map overlays & Geoprocessing Learn about spatial analysis functions overlays, clipping & buffering Use overlays to analyze multiple spatial criteria Understand.
Copyright © 2006 by Maribeth H. Price 6-1 Chapter 6 Queries.
Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language.
School of Geography FACULTY OF ENVIRONMENT Querying with ArcGIS.
Return to Outline Copyright © 2009 by Maribeth H. Price 4-1 Chapter 4 Attribute Data.
Geographic Information Systems Applications in Natural Resource Management Chapter 5 Selecting Landscape Features Michael G. Wing & Pete Bettinger.
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
Selecting features in ArcMap
Lecture 7 Basic GIS Analysis Operations
Copyright © 2006 by Maribeth H. Price 13-1 Chapter 13 Working with Geodatabases.
Return to Outline Copyright © 2009 by Maribeth H. Price 5-1 Chapter 5 Queries.
Restrictions Objectives of the Lecture : To consider the algebraic Restrict operator; To consider the Restrict operator and its comparators in SQL.
Introduction to Geographic Information Systems Fall 2013 (INF 385T-28620) Dr. David Arctur Research Fellow, Adjunct Faculty University of Texas at Austin.
# 1# 1 QueriesQueries How do we ask questions of the data? What is SELECT? What is FROM? What is WHERE? What is a calculated field? Spring 2010 CS105.
BIT 3193 MULTIMEDIA DATABASE CHAPTER 4 : QUERING MULTIMEDIA DATABASES.
GEOG 2007A An Introduction to Geographic Information SystemsFall, 2004 C. Earl Queries can be used: to check data correctness to obtain info as steps in.
1 Chapter 3 Single Table Queries. 2 Simple Queries Query - a question represented in a way that the DBMS can understand Basic format SELECT-FROM Optional.
CENTENNIAL COLLEGE SCHOOL OF ENGINEERING & APPLIED SCIENCE VS 361 Introduction to GIS SPATIAL OPERATIONS COURSE NOTES 1.
Chapter 6. Attribute Data & Tables. Table terminology Title Field Records Each field is specifically defined and established before any data can be entered.
城市空间信息技术 第十章 数据探查 胡嘉骢 不动产学院 博士 副教授 城市规划系主任 手机 : ( ) QQ:
Chapter 8- Queries What are queries? Extract certain records from a map or table Records meet certain criteria –Aspatial queries All parcels with value.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
IST 220 – Intro to DB Lab 2 Specifying Criteria in SELECT Statements.
Chapter 6 Spatial Joins.
Chapter 13 Editing and Topology.
GIS Institute Center for Geographic Analysis
Chapter 4 Attribute Data.
Chapter 2 Mapping GIS Data.
Chapter 12 Basic Editing.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 14 Geodatabases.
ArcMap: Geoprocessing
Chapter 10 Geocoding.
Spatial Analysis and Functions
Attribute Extraction.
Spatial Data Processing
Preliminaries: -- vector, raster, shapefiles, feature classes.
Mastering ArcGIS Chapter 7 Queries.
Structured Query Language
GIS Lecture: Selection
Basic Spatial Analysis Tools
GIS Lecture: Geoprocessing
GIS Institute Center for Geographic Analysis
Chapter 8 Advanced SQL.
Database Systems: Design, Implementation, and Management Tenth Edition
GIS Institute Center for Geographic Analysis
Presentation transcript:

Chapter 5 Queries

Outline About queries Attribute queries Spatial queries

What are Queries? Operation to extract certain records from a map or table. Records meet certain criteria Aspatial queries All parcels with value greater than $100,000. Spatial queries All parcels that lie completely within the flood plain

Why queries? Selecting features of interest Exploring patterns Isolating for more analysis Exploring spatial relationships

Attribute Queries Operation to extract specific values in the records from a table. Operation is based on SQL (Structured Query Language). SQL can write queries that work in multiple DBMS environments. Queries can be saved and reused. Nearly always case-sensitive.

SQL Examples Some Valid Queries SELECT *FROM cities WHERE "POP2010" >= 500000 SELECT *FROM counties WHERE “BEEFCOW_92” > “BEEFCOW_87” SELECT *FROM parcels WHERE “LU-CODE” = 42 AND “VALUE” > 10000 SELECT *FROM rentals WHERE “RENT” > 1000 AND “RENT” < 1500 In most databases, SQL expressions are case-sensitive “Smith” ≠ “SMITH”

Boolean expressions AND and OR are known as Boolean operators. Boolean operators are used to evaluate pairs of conditions. A AND B A OR B A B

AND vs OR? T A B C Let T = [all students in University] Let A = [students from New York] Let B = [Geography majors] Let C = [English majors] A AND B A B Select students from T where [Home_State] = “NY” AND [Major] = “Geography”

AND vs OR? T A B C Let T = [all students in University] Let A = [students from New York] Let B = [Geography majors] Let C = [English majors] A OR B A B Select students from T where [Home_State] = “NY” OR [Major] = “Geography”

Other Boolean operators A AND B A XOR B A NOT B A OR B A B Some databases use additional operators besides AND and OR.

Commutation of operators AND, OR and XOR are commutative A AND B == B AND A A OR B == B OR A A XOR B == B XOR A NOT is not commutative A NOT B ≠≠ B NOT A

Boolean operators have equal order or precedence Evaluation occurs from left to right Parentheses must be used to change order

Remember—you test each feature separately Test: AND vs OR Remember—you test each feature separately Wrong Right “Land-use” = ‘RES’ AND “Land-use” = ‘COM’ “Land-use” = ‘RES’ OR “Land-use” = ‘COM’ “Pop2000” ≥ 5000 OR “Pop2000” < 9000 “Pop2000” ≥ 5000 AND “Pop2000” < 9000

Searching for partial matches Sometimes you need to find one string within another rather than an exact match Find all customer names beginning with “Mac” or “Mc” Find all zip codes beginning with 0 Typically uses a “wildcard” character *Mac* or *Mc* 0*

The Like Operator “NAME” LIKE ‘%(D)%’ % is wildcard Finds all of the (D) Democrats % is wildcard Ignores Don or Danforth “NAME” LIKE ‘%New %’ Would find New Hampshire and New York, but not Newcastle or Kennewick

Basic spatial relationships Spatial queries Operation to extract records from a data layer based on location relative to another data layer. Basic spatial relationships 1. Intersection Does the road cross the aspen? Do two polygons share areas or boundaries? 2. Containment Is the aspen inside a geology unit? Is a road inside a geology unit? 3. Proximity How many aspen stands within 200 meters of a road.

Spatial operators Select the aspen stands that are intersected by roads. Spatial queries can employ a number of operators to test the basic conditions of intersection, containment, and proximity. The operators test relationships between two layers at a time. The target layer is the one containing the features to be selected The source layer is the one containing the features being compared to. Select the roads that are intersected by aspen stands.

Intersection operators Features intersect when any part of one feature touches, crosses, or overlaps another feature. The lower set includes “special cases” of intersecting features.

Types of containment Contains Completely contains One feature lies inside another and may share a boundary Oregon contains Columbia county Completely contains One feature lies inside another without touching the boundary Oregon does not completely contain Columbia county, but does completely contain Jefferson county Columbia Jefferson Within is the inverse of contains. Columbia county is within Oregon. Jefferson county is completely within Oregon.

Clementini operators Clementini considers the boundary of a polygon to be separate from its inside or outside. The Clementini operator is equivalent to the standard operator except when the source feature lies only on the boundary of the target feature.

Clementini example The Rio Grande River lies on the border of Texas The Contains operator would select the Rio Grande The Clementini Contains operator would NOT select the Rio Grande because the state boundary is not considered part of Texas Rio Grande River Conversely, the Rio Grande is within Texas using the standard operator, but is not within Texas using the Clementini operator.

Proximity operators This operator tests whether the target features are within a specified distance of the source features. Volcanoes within 100 km of an interstate

References Price, M. (2013). Mastering ArcGIS (6th ed.). McGraw-Hill Price, M. (2013). Mastering ArcGIS (6th ed.). McGraw-Hill. Mastering ArcGIS, 6/e Instructor Edition Chapter 5: PowerPoint Notes and Figures