Presentation is loading. Please wait.

Presentation is loading. Please wait.

Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language.

Similar presentations


Presentation on theme: "Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language."— Presentation transcript:

1 Query and Reasoning

2 Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language (SQL) – a database computer language designed for managing data in a relational database. Query by Location (Select by Location) –Spatial Query –Buffering a Distance from a feature –Overlapping features

3 Relational Database Structure Most common database structure used today –MS Access –ESRI ArcInfo & ArcGIS (including ArcMap) –Oracle Very robust; Can be expanded as needed Allows very complicated searches while maintaining very simple sets of tables Can become very large and complex

4 Relational Database Structure Employs an ordered set of attribute values called tuples grouped into 2D tables called relations A relation has a header and body The header consists of a fixed set of attributes (i.e. fields) The body consists of a set of tuples, a row is a single tuple Relations can be linked by a Primary Key field. A values within a field must come from the same Domain. A domain is the set of scalar values from which the actual values can be drawn.

5 Relational Database Structure S#SNAMESTATUSCity S1Clarke10Phoenix S2Smith20Tucson S3Jones10Tucson S4Smith30Flagstaff Relation: Suppliers 4 Tuples 4 Attributes Domain for City: All the cities in Arizona Primary Key: Unique identifier for relation, no two rows can have the same value in that column – only S# can serve as a primary key.

6 Table Record Relationships One One to One Many to One One to Many

7 Relational Database Structure Most common database structure used today –MS Access –ESRI ArcInfo (including ArcMap) –Oracle Very robust; Can be expanded as needed Allows very complicated searches while maintaining very simple sets of tables Can also become very large and complex

8 Quadrat #Species # 12 14 22.. Quadrat #CollectorDateSite #LatitudeLongitude 1Smith06/10/04235.1923-106.9478 2Jones07/11/04335.1923-106.8488 3Smith07/11/04..35.2345-106.9502 ……….. Species #Species NameType 1Conomyrma insanaGeneralist 2Pogonomyrmex rugosusSpecialist 3…… ……… Quadrats table Species code no. table Species table Table Record Relationships Links

9 Relational Database Structure All Relations must satisfy four properties –They can not contain duplicate tuples –There is no ordering of the tuples –There is no ordering of the attributes –All attributes values are atomic

10 Queries All tabular queries use Boolean Logic. Boolean logic involves True/False sets (Yes/No, 1/0) on which Boolean logical operators (or connectors) such as AND, OR, NOT and XOR can be applied. Going back to basic set theory, a group of individuals are either in a specific set or not.

11 Queries You can define a set by delineating a condition using logic (or relational) operations such as: –EQ or = [operand_1] is equal to [operand_2] –NE or <> [operand_1] is not equal to [operand_2] –GE or >= [operand_1] is greater than or equal to [operand_2] –LE or <= [operand_1] is less than or equal to [operand_2] –GT or > [operand_1] is greater than [operand_2] –LT or < [operand_1] is less than [operand_2] Only EQ and NE can be used on character string data.

12 You can the write a query or logic expression to find different sets with a relation like the one below ID#NameGross Income AgeGender 1Smith40,00035M 2Jones27,00025M 3Jordan57,00030M 4Miller30,00028F 5Hiller18,00018M 6Brown100,50045F 7White21,00036F 8Richards33,00052F 9Hurley60,00050M 10O’Brain30,00033M We can then define a set of tuples with a logic expression such as: Gender = F The members of the Set Gender = F are ID#’s 4, 6, 7, 8 The logic expression Age > 40 results in a set with three members: ID#’s 6, 8, 9

13 Complex Queries You can then write expressions with logical connector to define sets based on multiple conditions: –Gender = F: 4, 6, 7, 8Age > 40: 6, 8, 9 –Gender = F AND Age > 40: 6, 8 –Gender = F OR Age > 40: 4, 6, 7, 8, 9 –Gender = F NOT Age > 40: 4, 7 –Gender = F XOR Age > 40: 4, 7, 9

14 States with more than 45% of its Population Under 15 years of Age

15 Select by Location

16 Select by Location Tool Adds, updates, or removes a selection on the input layer based on spatial relationships to features in another layer. Spatial Relationships: Intersect Within a Distance Contains Completely Contains Contains Clementini Within Completely Within Within Clementini Are Identical To Boundary Touches Share a Line Segment With Crossed by the Outline Of Have Their Center in

17 Contain vs Within CONTAIN: selects features in the Input Feature Layer which contain a feature in the Selecting Features layer. The Selecting Features can be inside as well as on the boundary of the Input Feature Layer. WITHIN: will select features in the Input Feature Layer which are within or contained by features in the Selecting Features layer.

18 3 Contain Spatial Relationships CONTAIN: selects features in the Input Feature Layer which contain a feature in the Selecting Features layer. The Selecting Features can be inside as well as on the boundary of the Input Feature Layer. COMPLETELY_CONTAINS: Selecting Features layer does not intersect the boundary of the Input Feature Layer. CONTAINS_CLEMENTINI: the results will be identical to CONTAINS with the exception that if the feature in the Selecting Features layer is entirely on the boundary of the Input Feature Layer, with no part of the contained feature properly inside the feature in the Input Feature Layer, the input feature will not be selected.

19 Intersect

20 Are Within A Distance of

21 Are Within

22 Contain

23

24

25 Implementation Selection Menu in ArcMap –Select by Attribute is also available from a Table Options Menu ArcToolbox – Data Management  Layers and Table View

26

27 Overlay Functions Result is a new data layer, not a selection features. Used on feature (vector) data. Geoprocessing Menu – Analysis Tools –Buffer: Creates a polygon with a defined radius –Clip: Extracts input features that overlay the clip features Special tool for Raster/Grid Clips –Union: Outputs all features, overlap and non-overlap –Intersect: Outputs only overlapping features –Merge: Combines multiple input datasets Append: Combines an input dataset with an existing dataset – Dissolve: Aggregates features based on specified attributes

28 Proximity analysis: bufferi ng Create a new area within a user-defined distance of an existing entity e.g., to determine areas impacted by a proposed highway

29 Point Line Area

30

31


Download ppt "Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language."

Similar presentations


Ads by Google