GIS UPDATE? Lecture 17 Lab 8: Music Festival, Part 2 – Spatial Analysis.
-
Upload
kory-reeves -
Category
Documents
-
view
222 -
download
1
Transcript of GIS UPDATE? Lecture 17 Lab 8: Music Festival, Part 2 – Spatial Analysis.
GIS UPDATE?Lecture 17Lab 8: Music Festival, Part 2 – Spatial Analysis
Attributes and Queries: An Introduction
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? * Are environmental areas 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? * What areas have the most fire fuels (e.g. dead wood)?
To answer these questions, we need information:
* Counts of species. * Counts of people, animals, houses, etc. * Height of trees, buildings, etc. * Size and permieter of areas. * Length of streams or roads. * Ownership of parcels.
This type of data can be found within the Attributes of a shapefile.
Example: Census Scope
Census Scope is an organization that makes census information available. Navigate to this site and 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 by county level (i.e. a polygon layer of counties).
Queries and Calculations
In order to answer the questions raised in Attributes: An Introduction, we also need to select (query) certain types of information, such as: * 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, and Calculations
• Attributes are associated with features and are located within the Attribute Table. Queries "Select" data through the "Select by Attribute" tool, which is based on Structured Query Language (SQL). Calculations can be made through Calculate Geometry and Field (column) Calculator.
• Each layer has a table attached to it, where each row is tied to a particular feature (point, line, or polygon) within that layer. Each column (field) represents a different attribute, such as: Name, type, or some other property.
• The Attribute Table is similar to Microsoft Excel, in that each row is tied to a feature, you can add and delete columns, and adding and deleting rows will add or delete features.
Test Your Knowledge
What is each row tied to?• Height of trees• Ownership of parcels• A different attribute (name, type, or some other property)• A particular feature (point, line, or polygon)
A particular feature (point, line, or polygon)
Attributes: Terminology
ESRI borrows labels from four disciplines for attributes:
It's fairly common to find Attributes within Vector data, but Raster data is not so likely. Some examples of attributes are: * Name * Population/Census numbers * Vegetation characteristics * Dates * Coordinates * Ownership * Park Type
Vector Attributes
Vector Attributes are used for labels, symbology, selection, and sub-setting.
Some examples of Labels are: * Direct: Names of cities, states, etc. * Results of "expressions;" e.g. city with its population.
Symbology: * Size city by its population.
Selection: * Select cities over a certain size.
Sub-setting: * Create a new layer with cities over 1 million residents.
Test Your Knowledge
Vector attributes are used for all of the following, EXCEPT:• Labels• Records• Symbology• Selection• Sub-setting
Records
Attributes: Types
There are two types of Attribute Data: Qualitative and Quantitative. Qualitative data is nominal, meaning types, but no specific order to them. Quantitative data is either Ordinal (ordered sets of classifications), Interval (values along non-arbitrary scale), or Cyclic (values that repeat).
An example of Qualitative Data is:• Nominal - Land Cover Type
Some examples of Quantitative Data are:• Ordinal - Fire danger low, medium, or high.• Interval - Temperature.• Ratio - Population Density (floating point), or number of people per area.• Ratio is similar to Interval, except that it has a meaningful "0" value (i.e. population
density)• Cyclic - Directions (0 to 360 degrees)
Examples of Attributes:
* Names * Taxonomic Identification * Scientific names, common names, codes (NRCS codes). * Organism characteristics * Population values * Distance or area * Dates * Collector's names * Coordinates
Test Your Knowledge
What is NOT an example of Quantitative data?
• Ordinal• Ratio• Cyclic• Nominal• Interval
Nominal
Structured Query Language (SQL)
SQL comes from the database industry, and you can "INSERT," "DELETE," and "SELECT" rows in tables. It comes with a very rich syntax, and portions of "SELECT" grammar are 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
Fields
Records
Filter Examples
• Where:• "FID" = 1• "Area" < 10000• "Area" <= 10000• "Name" = 'Crater Lake' (case
dependent)• "Name" LIKE 'Crater Lake' (ignore
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 = 1False = F = 0
Boolean Operators:
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.
OperatorsBoolean Operators: Used to combine expressions.
1. And "Area" > 10000 AND "IMPR" = 0
2. Or "RAINFALL" < 20 OR "SLOPE" > 35
3. Not NOT ("STATE_NAME"='Colorado')
4. Xor [RAINFALL] > 20 XOR [SoilType] = 'X‘“Xor” a logical operation that outputs true whenever both inputs differ (one is true, the other is false).
Order Matters:(A AND B) OR C is not the same as A AND (B OR C)!And - Must meet both criteria.Or - Can meet either criteria.
Boolean Operators: Used to combine expressions.
Comparison Operators: Used to compare values.
Operator Description< Less Than> Greater Than<= Less Than or Equal to>= Greater Than or Equal to= Equal to<> Not Equal to
Test Your Knowledge
AND can meet either criteria• False• True
FalseOR can meet either criteria; AND must meet both criteria.
Joins and Relates
There are two ways to combine tables: Joins and Relates.
Joins are used for 1-to-1 relationships, or many-to-1 relationships between the attribute table and an external table.
Relates are used for 1-to-many relationships, or many-to-many relationships between the attribute table and an external table.
Table Join:Combines two tables based on the value of a field that can be found in both tables (a "common field").
Join Examples in ESRI ArcMap
Relate Examples in ESRI ArcMap
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.
Test Your Knowledge
Relates are used for 1-to-many relationships.• False• True
TrueRelates are used for 1-to-many, or many-to-many relationships.
Adding Fields
When adding a new field into a Shapefile, you must make sure that the Shapefile is not marked as Read-Only and that you are not presently in an Edit Session. 1. Select "Add Field" from the Options Menu. 2. Name the Field. 3. Select the type of data. 4. Be careful with "Precision.“
Checking the Edit Session 1. Right-Click on the menu bar. 2. Select "Editor" 3. If "Start Editing" is grayed out: a. Select "Stop Editing."
Adding Fields
Naming Fields
Arc only allows 10 characters when naming fields. Remember, you will be using the Name in calculations and queries!
Select the Field Properties
Types:
Short Integer 16-bit Integer (5 digits)Long Integer 32-bit Integer (9 digits)Float 32-bit Floating PointDouble 64-bit Floating PointText Up to 254 CharactersDate MM/DD/YYYY Format
Precision: Describes the number of digits that can be stored in the field. All digits are counted no matter what side of the decimal they are on.Scale: Sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types.
Precision Can Change "Type"
Short Integer 16-bit Integer (5 digits)Double 64-bit Floating Point
Delete a Field
You must be outside of an edit session to delete fields within the attribute table.
Editing Attribute Values
The attribute "table" contains rows and columns similar to a spreadsheet. However, it's history and future are based on databases, where Columns are Fields, and Rows are Records.
We can add and delete columns (fields), and adding and deleting features adds and deletes rows.
Calculate Geometry
Editing Attribute Values
• If attributes won't change:• Make sure you're in an edit session
• Double-click on the cell to type in a new value
• Use the "Field Calculator" to change entire columns
Start Editing
Without an Edit Session - ArcGIS will not track your changes, so "Undo" will not work!
Making Changes
• Click (or double-click) in the cell• Type changes - Easy!• Dates are in MM/DD/YYYY format
If you do not select "Stop Editing," than your changes will not be saved.
Coordinate Attributes
It is common to see Lat/Lon or Easting/Northing in attribute tables for point layers. These are not the values used to render the spatial data! These values are not updated when you project, edit, or transform the spatial data!
To update these columns...Selection
• Selection tab on TOC• Manual Selection• Click to select• Shift-click to add/remove from selection
• Select by Attributes• Select by Location• Right-click on layer --> Selection --> Create Layer from Selected Features• Then, "Export" the data to a new file
Select by Attributes
Select by Attributes• SELECT * FROM TableName WHERE: • "WHERE Clause" or Filters
Test Your Knowledge
Attribute Table values are updated when you project data.• False• True
FalseAttribute Table values do NOT update when you project data. This must be done manually with ArcMap tools such as Calculate Geometry.