Attributes & Queries Reading Assignment: Bolstad, Ch. 8 (p. 307-346)
-
Upload
briana-copeland -
Category
Documents
-
view
220 -
download
2
Transcript of Attributes & Queries Reading Assignment: Bolstad, Ch. 8 (p. 307-346)
Attributes & Queries
Reading Assignment: Bolstad, Ch. 8 (p. 307-346)
Attributes
• To make decisions we need information about the spatial areas in Shapefiles:– Which parcels are big enough for my house?– Which areas have more poverty for development
funds?– Where environmental areas are threatened by
encroaching development?– How many endangered species are in each area?– How many fish are in each stream?– Who borders the streams we need to restore?– Which areas of the most fire fuels (dead wood)?
Attributes
• To answer questions we need information:– Counts of species– Counts of people, animals, houses, etc.– Height of trees, buildings, etc.– Size and perimeter of areas– Length of streams, roads– Ownership of parcels
• These are held in attributes
Census Scope
• An organization making census information available
• http://www.censusscope.org• Check out the variety of maps, charts, and tables
they have made available from US census data. • These are computed using attributes of the
census data at a county level (i.e. a polygon layer of counties).
Queries and Calculations
• We also need to select (query) certain types of information:– People over 60 years old– Parcels over 1 acre– Areas with 1 or more endangered species
• And compute new values:– Number of animals per meter– Density of trees– Board feet per acre– Fish per meter
Attributes, Queries, Calculations
• Attributes are associated with features – In the Attribute table
• Queries “Select” data – Available in “Select by Attribute”– Based on Structured Query Language (SQL)
• Calculations available in:– Geometry calculator– Field (column) calculator
Attributes
• Table attached to each layer• Each row tied to a feature
– Point– Polyline(s)– Polygon(s)
• Each column (field) represents a different attribute and has:– Name– Type– Other properties
Attribute Terminology
Attribute “Table”
Row or Record- One per feature
Column or Field
Feature, Object, or Record ID
Attribute Terminology
• Esri borrows from four disciplines for labels for attributes
Spatial Data Spreadsheet Database OOP
Attribute Table Spreadsheet Table -
An attribute Column Field Property
Feature ID? Row Number Record ID Object ID
Attributes for one feature
Row Record Object’s properties
Attribute value Cell Entry Property Value
Filter Selection Query -
Attributes
• Vector Attributes (very common)• Raster Attributes (when available)• Examples of attributes:
– Name– Population/Census numbers– Vegetation characteristics– Dates– Coordinates– Ownership– Park Type
Vector Attributes
• Used For:– Labels:
• Direct: Names of cities, states, etc.• Results of “expressions”: City with it’s population
– Symbology:• Size city by it’s population
– Selection• Select cities over a certain size
– Sub-setting• Create a new layer with cities over 1 million
Types of Attributes
• Qualitative– Nominal: No order, types
• Quantitative– Ordinal: Ordered set of classifications– Interval: Values along arbitrary scale– Ratio: Values along non-arbitrary scale– Cyclic: Values repeat
Types of Attributes (examples)
• Qualitative– Nominal: Land Cover Type
• Quantitative– Ordinal: Fire danger low, medium, high– Interval: Temperature– Ratio: Population Density (floating point)
• Number of People / Area– Cyclic: Directions (0 to 360 degrees)
Examples of Attributes
• Names• Taxonomic Identification:
– Scientific Names, common names, codes (NRCS codes)
• Organism characteristics• Population values• Distance, Area• Dates• Collector’s names• Coordinates
Structured Query Language (SQL)
• Comes from the database industry• “INSERT”, “DELETE”, and “SELECT” rows in
tables• Very rich syntax• Portions of “SELECT” grammar used heavily
in ArcGIS:– Selecting attributes– Raster calculator– Geodatabases
Select by Attributes
• SELECT * FROM TableName WHERE:– “WHERE Clause” or Filters
• Available from the Attribute Table
Attributes in ArcGIS
Filter Examples
• WHERE:– FID = 1– “Area” < 10000– “Area” <= 10000– “Name” = ‘Crater Lake’ (case dependent)– “Name” LIKE ‘Crater Lake’ (ignores case)
• Notice:– Fields have double quotes– String values have single quotes
SQL Comparisons
• Equals: =• Greater than: >• Less than: <• Greater than or equal: >=• Less than or equal: <=• Not equal: <>• Like: case independent string comparison with
wild cards (%)
Boolean Values
• True = T = 1 • False = F = 0
Boolean Operators
A B A AND B A OR B NOT A NOT B
T T T T F F
T F F T F T
F T F T T F
F F F F T T
More Complex Filter Examples
• WHERE:– “Name” LIKE ‘Hawaii’ AND Area < 10000– “Species” LIKE ‘Ponderosa’ AND DBH > 1
Select by Location
• Proximal• Topological
– Identical– Adjacent– Within– Share segment
Table Queries:The selection of a subset of features that meet some criteria.
“Area” > 20.0 “Landuse” = ‘Urban’ AND “Municip” = ‘City’
Expression: A sequence of operands and operators constructed according to the syntactic rules of a symbolic language (SQL)
Boolean Operators: Used to combine expressions
1) And
2) Or
3) Not
4) Xor
“AREA” > 10000 AND “IMPR” = 0
“RAINFALL” < 20 OR “SLOPE” > 35
NOT ("STATE_NAME" = ‘Colorado’)
[RAINFALL] > 20 XOR [SoilType] = ‘X’
Order matters:
(A AND B) OR C is not the same as
A AND (B OR C)
And – Must meet both criteriaOr – Can meet either criteria
Boolean Operators: Used to combine expressions
1) And
2) Or
3) Not
4) Xor
“AREA” > 10000 AND “IMPR” = 0
“RAINFALL” < 20 OR “SLOPE” > 35
NOT ("STATE_NAME" = ‘Colorado’)
[RAINFALL] > 20 XOR [SoilType] = ‘X’
Order matters:
(A AND B) OR C is not the same as
A AND (B OR C)
Operator Description
< less than
> greater than
<= less than or equal to
>= greater than or equal to
= Equal to
<> not equal to
Comparison Operators: Used to compare values
Two ways to combine tables:
JoinsUsed for 1-to-1 relationships, or many-to-1 relationships between attribute table and external table.
Relates Used for 1-to-many relationships, many-to-many relationships between attribute table and external table.
Table Join:Combines two tables based on the value of a field that can be found in both tables (a “common field”).
Parcel-ID Owner
2 John Smith
5 Bruce Martin
6 Anne Davis
1 Steve Arnold
8 Rick James
Parcel-ID Acres
2 2
5 1.5
6 6
1 3
8 1.6
Parcel-ID Acres Owner
2 2 John Smith
5 1.5 Bruce Martin
6 6 Anne Davis
1 3 Steve Arnold
8 1.6 Rick James
Table A Table B
Joins and Relates JoinJoins and Relates Join
A Join lets you join data from an external table to your attribute table based on the value of a field that can be found in both tables.
A Join lets you join data from an external table to your attribute table based on the value of a field that can be found in both tables.
+
Attribute tableExternal Tabular File (immigration)
Example of 1:1 relationship
Results of Join OperationResults of Join Operation
Example of Many-to-1 relationshipExample of Many-to-1 relationship
Join
Example of 1-to-many relationship
Relate
Joins and Relates RelateJoins and Relates Relate
Options Related TablesOptions Related Tables
Example of 1-to-many relationship
Relate
SummarizeCreates a new table containing one record for each unique value occurring in a selected field along with statistics summarizing the data in any of the other fields.
Group together All records that have the same State name.Get summary stats on the values in the rain field.
SummarizeSummarize
Find combined (total) area for each “covertype”
Summarize QuantitativeBy Qualitative!