Download presentation
Presentation is loading. Please wait.
Published byEgbert Holmes Modified over 9 years ago
1
Return to Outline Copyright © 2009 by Maribeth H. Price 4-1 Chapter 4 Attribute Data
2
Return to Outline Copyright © 2009 by Maribeth H. Price 4-2 Outline GIS Concepts –What is a table?What is a table? –Queries on tablesQueries on tables –Joining and relating tablesJoining and relating tables –Summary statisticsSummary statistics –Database storage conceptsDatabase storage concepts About ArcGIS –Working with tables in ArcGISWorking with tables in ArcGIS –Editing and calculating fieldsEditing and calculating fields –Using Excel data with ArcGISUsing Excel data with ArcGIS
3
Return to Outline Copyright © 2009 by Maribeth H. Price 4-3 What is a table?
4
Return to Outline Copyright © 2009 by Maribeth H. Price 4-4 Table terminology Title Field Records Each field is specifically defined and established before any data can be entered. Field definitions control the type of data that can be stored in a field.
5
Return to Outline Copyright © 2009 by Maribeth H. Price 4-5 Types of tables Attribute table –Stores attributes of map features –Associated with a spatial data layer –Has special fields for spatial information Standalone table –Stores any tabular data –Not associated with spatial data –OID instead of FID
6
Return to Outline Copyright © 2009 by Maribeth H. Price 4-6 Database Management Systems Dedicated systems for managing tables of data Provide data management for agencies, universities, companies, etc. Designed for multi-user environments with enhanced security needs Focus on data tables with tools for queries, reporting, graphing, etc.
7
Return to Outline Copyright © 2009 by Maribeth H. Price 4-7 Queries on tables
8
Return to Outline Copyright © 2009 by Maribeth H. Price 4-8 What is a query? A query extracts certain records from a table based on a specified condition –How many students have GPA > 3.5? –How many states have population > 1 million? –How many counties had greater population in 1990 than in 2000? –How many customers have last names beginning with “Mac” or “Mc”?
9
Return to Outline Copyright © 2009 by Maribeth H. Price 4-9 SQL Many databases use a special query language called Structured Query Language Can write queries that work in multiple DBMS environments Queries can be saved and reused Nearly always case-sensitive
10
Return to Outline Copyright © 2009 by Maribeth H. Price 4-10 SQL Query Examples Some Valid Queries SELECT *FROM cities WHERE "POP1990" >= 500000 SELECT *FROM counties WHERE “BEEFCOW_92” < “BEEFCOW_87” SELECT *FROM parcels WHERE “LU- CODE” = 42 AND “VALUE” > 50000 SELECT *FROM rentals WHERE “RENT” > 700 AND “RENT” < 1500 Programs may have an interface to help users build SQL expressions In most databases, SQL expressions are case-sensitive “Smith” ≠ “SMITH”
11
Return to Outline Copyright © 2009 by Maribeth H. Price 4-11 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*
12
Return to Outline Copyright © 2009 by Maribeth H. Price 4-12 The Like Operator “NAME” LIKE ‘%(D)%’ –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
13
Return to Outline Copyright © 2009 by Maribeth H. Price 4-13 Query results The result of a query is a set of selected records that meet the criteria Subsequent operations on the table will use only the selected records and ignore the others. A user might… –Export the selected records to a new table –Calculate statistics on the selected records –Calculate new values for the selected records –Produce a report based on the selected records
14
Return to Outline Copyright © 2009 by Maribeth H. Price 4-14 Joining and relating tables
15
Return to Outline Copyright © 2009 by Maribeth H. Price 4-15 Joining tables Join tables on common field Joined table Destination tableSource table
16
Return to Outline Copyright © 2009 by Maribeth H. Price 4-16 Join facts Joins are temporary relationships between tables used by a relational DBMS Tables must share a common field (key) Treats the two tables as a single table Original stored data is not affected Can be removed when no longer needed
17
Return to Outline Copyright © 2009 by Maribeth H. Price 4-17 One-to-one joins When each record in the destination table matches exactly one record in the source table, we call it a cardinality of one- to-one. Destination table (always imagine on the left) Source table (always imagine on the right)
18
Return to Outline Copyright © 2009 by Maribeth H. Price 4-18 Types of Cardinality One-to-one –States to Governors –Husbands to wives One-to-many –States to cities –Districts to schools Many to one –Cities to states –Schools to districts Many-to-many –Students to classes –Stores to customers In evaluating cardinality, always put the destination first. (Destination on the left)
19
Return to Outline Copyright © 2009 by Maribeth H. Price 4-19 Rule of Joining Each record in the destination table must match one and only one record in the source table. One to one Destination table Source table Many to one
20
Return to Outline Copyright © 2009 by Maribeth H. Price 4-20 One to many Destination table Source table ? Violates the Rule of Joining Record to join to destination is ambiguous Must use a relate instead
21
Return to Outline Copyright © 2009 by Maribeth H. Price 4-21 Relates Similar to a join except that –The tables remain separate –Items selected in one table may be highlighted in the related table
22
Return to Outline Copyright © 2009 by Maribeth H. Price 4-22 States: Select the New England States Congress Reps of New England States Related tables
23
Return to Outline Copyright © 2009 by Maribeth H. Price 4-23 Summary statistics
24
Return to Outline Copyright © 2009 by Maribeth H. Price 4-24 Statistics on a table field Based on values in a field. Includes all records or a subset based on a query.
25
Return to Outline Copyright © 2009 by Maribeth H. Price 4-25 Summarizing tables Calculate statistics for groups of features in a table Groups by unique values in the one field User chooses statistics to calculate for other fields Produces another table as output with groups and stats How many people live in each subregion? What is the total area of each subregion?
26
Return to Outline Copyright © 2009 by Maribeth H. Price 4-26 Summarizing tables How many earthquakes in each state? Total deaths and damage in each state? Average magnitude in each state? Historic major earthquakes
27
Return to Outline Copyright © 2009 by Maribeth H. Price 4-27 How to summarize Right-click State field Sum Deaths Sum Damage Average Mag Average MMI
28
Return to Outline Copyright © 2009 by Maribeth H. Price 4-28 Database storage concepts
29
Return to Outline Copyright © 2009 by Maribeth H. Price 4-29 Fields Fields have specific types available Must be defined before use Once defined, cannot be changed Naming rules –No more than 13 characters –Use only letters and numbers –Must start with a letter
30
Return to Outline Copyright © 2009 by Maribeth H. Price 4-30 Binary data Fundamental mode of computer storage Data are stored as a series of 0’s and 1’s representing numbers in base 2 (bits) Bits are grouped by eight to form 1 byte. A megabyte (MB) is 1 million bytes. 10011101 1 bit one byte In base 2: 00000000 = 0 11111111 = 255 2 8 = 256 1111111111111111 = 65,565 2 16 = 65,566 two bytes 0 1 10 11 100 101 110 111 1000 1001 1010 1011
31
Return to Outline Copyright © 2009 by Maribeth H. Price 4-31 ASCII storage American Standard Code for Information Interchange (ASCII) Stores letters, characters, and symbols as single 7-bit binary codes CAT = {67,65,84} decimal = 100001110000011010100 cat = {99,97,116} decimal = 110001111000011110100 148 = {49,52,56} decimal = 011000101101000111000
32
Return to Outline Copyright © 2009 by Maribeth H. Price 4-32 About ArcGIS Chapter 4. Attribute Data
33
Return to Outline Copyright © 2009 by Maribeth H. Price 4-33 Working with tables in ArcGIS
34
Return to Outline Copyright © 2009 by Maribeth H. Price 4-34 Tables in ArcGIS Tables contain attribute data Many formats, one interface
35
Return to Outline Copyright © 2009 by Maribeth H. Price 4-35 Sources of tables Dbase files INFO files ASCII Text files (tab or comma delimited) Records from SQL database systems Excel worksheets
36
Return to Outline Copyright © 2009 by Maribeth H. Price 4-36 ArcMap table interface Title Field Right-click field name to get menu Records Status bar Options menu
37
Return to Outline Copyright © 2009 by Maribeth H. Price 4-37 Adjusting field width Temporary, does not affect stored file Hover over field break to get double arrow, then drag
38
Return to Outline Copyright © 2009 by Maribeth H. Price 4-38 Field properties tab Field alias Hide field
39
Return to Outline Copyright © 2009 by Maribeth H. Price 4-39 Shortcut to field properties
40
Return to Outline Copyright © 2009 by Maribeth H. Price 4-40 Formatting field display
41
Return to Outline Copyright © 2009 by Maribeth H. Price 4-41 Table appearance
42
Return to Outline Copyright © 2009 by Maribeth H. Price 4-42 Sorting tables Has no effect on original data
43
Return to Outline Copyright © 2009 by Maribeth H. Price 4-43 Select by Attributes Some valid queries [POP1990] > 1000000 “STATE_NAME” = ‘Alabama’ [POP2000] >= [POP1990] Note: DBF tables have field names enclosed in quotes Geodatabase tables have field names enclosed in brackets
44
Return to Outline Copyright © 2009 by Maribeth H. Price 4-44 Selecting records
45
Return to Outline Copyright © 2009 by Maribeth H. Price 4-45 Show selected
46
Return to Outline Copyright © 2009 by Maribeth H. Price 4-46 Clear Selection On toolbar From table options menu From main menu
47
Return to Outline Copyright © 2009 by Maribeth H. Price 4-47 Field statistics
48
Return to Outline Copyright © 2009 by Maribeth H. Price 4-48 Statistics Statistics for fields are based on the selected records
49
Return to Outline Copyright © 2009 by Maribeth H. Price 4-49 ArcGIS field data types Geodatabases and shapefiles Short Integers stored as signed 2-byte binary numbers (value range from -32,000 to +32,000) 255 1201 Long Integers stored as signed 4-byte binary numbers (value range from -2 billion to +2 billion) 156000 Float Floating point values with 8 significant digits in the mantissa 1.2893851e12 Double Double-precision floating point values with 16 significant digits in the mantissa 1.1111111111111 11e13 Text Alphanumeric strings‘Maple St’ Date Date format07/12/92 BLOB Binary large object; any complex binary data including images, documents, etc.
50
Return to Outline Copyright © 2009 by Maribeth H. Price 4-50 Field characteristics Length –The total characters a text field can store Precision –The total width of digits a numeric field can store Scale –The number of decimal places Length = 10 Maple St. Maple Stre 156 1985.128 -1922.5600 0.001 0.00001
51
Return to Outline Copyright © 2009 by Maribeth H. Price 4-51 Adding a new field In ArcCatalog layer properties 4 3 1 5 2
52
Return to Outline Copyright © 2009 by Maribeth H. Price 4-52 Adding a field In ArcMap
53
Return to Outline Copyright © 2009 by Maribeth H. Price 4-53 Editing and calculating fields
54
Return to Outline Copyright © 2009 by Maribeth H. Price 4-54 Editing fields Open Editor toolbarStart editing Type edits in fields Save edits, stop editing
55
Return to Outline Copyright © 2009 by Maribeth H. Price 4-55 Calculating fields Add a new field if necessary Consider whether you need decimal places!
56
Return to Outline Copyright © 2009 by Maribeth H. Price 4-56 Calculate Right-click field to calculate Enter expression
57
Return to Outline Copyright © 2009 by Maribeth H. Price 4-57 Geodatabase geometry measures Automatically created and maintained –Usually appear at end of table Shape_Area field Shape_Length field –Units will match units of the coordinate system
58
Return to Outline Copyright © 2009 by Maribeth H. Price 4-58 Coverage geometry measures –Automatically constructed –Updated whenever the BUILD or CLEAN command is used to update topology LENGTH field in arc tables AREA field in polygon tables PERIMETER field in polygon tables
59
Return to Outline Copyright © 2009 by Maribeth H. Price 4-59 Shapefile geometry measures Shapefiles DO NOT create or maintain these fields automatically! –Must be created and updated manually –Some functions and operations can change the lengths and areas of features –If you find an AREA field there is no guarantee that it is correct
60
Return to Outline Copyright © 2009 by Maribeth H. Price 4-60 Be careful! Before After AREA/LENGTH/PERIMETER fields in shapefiles are NOT automatically updated if features change. Don’t use one of these fields unless you are CERTAIN that they are correct. These area/perimeter fields are likely from a coverage
61
Return to Outline Copyright © 2009 by Maribeth H. Price 4-61 User geometry calculations Create field to hold values Choose type, coordinate system, and units Not automatically updated if features change!!!
62
Return to Outline Copyright © 2009 by Maribeth H. Price 4-62 Test yourself: True or False? A field named AREA in a shapefile will always have the correct area? –False. Shapefile area fields are not automatically maintained. A field named AREA in a geodatabase will always have the correct area? –False. Automatically updated fields in a geodatabase are called Shape_Area. A field named AREA in a coverage will always have the correct area? –True. Automatically updated area fields in a coverage ARE called AREA.
63
Return to Outline Copyright © 2009 by Maribeth H. Price 4-63 How to join or relate tables To start, right- click the destination table.
64
Return to Outline Copyright © 2009 by Maribeth H. Price 4-64 Using Excel data with ArcGIS
65
Return to Outline Copyright © 2009 by Maribeth H. Price 4-65 Excel files Excel worksheets with suitable layout can be opened as tables in ArcGIS Most functions that do not involve changing the file will work (sort, query) Tables cannot be changed or edited
66
Return to Outline Copyright © 2009 by Maribeth H. Price 4-66 Excel file requirements First row must contain field headings with legal field names as defined earlier No blank rows or formulas should be used Each column should contain only text or only numbers. It is helpful for each column to be formatted as text, numeric, etc. ArcMap cannot open files that are already open in Excel—they must be closed first
67
Return to Outline Copyright © 2009 by Maribeth H. Price 4-67 Acceptable Worksheet Correct field names Columns formatted as text or numeric No formulas or blank lines
68
Return to Outline Copyright © 2009 by Maribeth H. Price 4-68 Workbooks and worksheets An Excel workbook file (.xls) may contain more than one worksheet. By default there are three named Sheet1, Sheet2, Sheet3. There may be one or more named worksheets. ArcMap can only open one worksheet at a time. You will open the workbook like a folder and select a single worksheet
69
Return to Outline Copyright © 2009 by Maribeth H. Price 4-69 Adding a worksheet 1. Add data button 2. Open workbook file like a folder 3. Add named worksheet, or the first unnamed worksheet.
70
Return to Outline Copyright © 2009 by Maribeth H. Price 4-70 Excel file in ArcMap You can use x-y locations in a table to produce points on a map. But first you must know the coordinate system of these locations. What is this one?
71
Return to Outline Copyright © 2009 by Maribeth H. Price 4-71 Add XY Data You MUST use the Edit button to define the coordinate system. Degrees indicate a geographic coordinate system (GCS). NAD83 is the most common in use today, but if you know it is something different you must use that. Other tables might have units in UTM meters, State Plane feet, etc. You must know the coordinate system to create usable, correctly located points.
72
Return to Outline Copyright © 2009 by Maribeth H. Price 4-72 Oregon climate stations Stations appear as points on the map, an “event layer” Export to shapefile or feature class to keep permanently
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.