420 likes | 589 Views
GSP 270. 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?
E N D
GSP 270 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” Feature, Object, or Record ID Row or Record - One per feature Column or Field
Attribute Terminology • Esri borrows from four disciplines for labels for attributes
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
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
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 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)
Operators Boolean Operators: Used to combine expressions • And • Or • Not • Xor Order matters: (A AND B) OR C is not the same as A AND (B OR C) “AREA” > 10000AND“IMPR” = 0 “RAINFALL” < 20 OR “SLOPE” > 35 NOT ("STATE_NAME" = ‘Colorado’) [RAINFALL] > 20 XOR [SoilType] = ‘X’ And – Must meet both criteria Or – Can meet either criteria
Operators Boolean Operators: Used to combine expressions • And • Or • Not • Xor Order matters: (A AND B) OR C is not the same as A AND (B OR C) “AREA” > 10000AND“IMPR” = 0 “RAINFALL” < 20 OR “SLOPE” > 35 NOT ("STATE_NAME" = ‘Colorado’) [RAINFALL] > 20 XOR [SoilType] = ‘X’ Comparison Operators: Used to compare values
Joins and Relates Two ways to combine tables: Joins Used 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 Table Join: Combines two tables based on the value of a field that can be found in both tables (a “common field”). Table B Table A
Joins 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.
External Tabular File (immigration) Attribute table + Example of 1:1 relationship
Summarize Summarize Creates 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.
Find combined (total) area for each “covertype” Summarize Quantitative By Qualitative! Summarize