670 likes | 887 Views
Lecture 4 Geodatabases. Geodatabases Outline. Data types Geodatabases Data table joins Spatial joins Field calculator Calculate geometry ArcCatalog functions. Lecture 4. Data types . Directly loadable data types. dBase (.dbf) Text with comma (.csv) or tab-separated values (.txt)
E N D
Geodatabases Outline INF385T(28437) – Spring 2013 – Lecture 4 Data types Geodatabases Data table joins Spatial joins Field calculator Calculate geometry ArcCatalog functions
Lecture 4 Data types INF385T(28437) – Spring 2013 – Lecture 4
Directly loadable data types INF385T(28437) – Spring 2013 – Lecture 4 • dBase (.dbf) • Text with comma (.csv) or tab-separated values (.txt) • Microsoft Access (.mdb) • Microsoft Excel (.xls)
Data table formats INF385T(28437) – Spring 2013 – Lecture 4 • First row must have attribute names with self-documenting labels • (e.g. Pop5To17, Area) • Usual naming convention • first character is a letter • remaining characters be any letters, digits, or the underscore character • All additional rows of a data table contain attribute values • None of the rows can be sums, averages, or other statistics of raw data rows
Lecture 4 geodatabases INF385T(28437) – Spring 2013 – Lecture 4
Geodatabase types INF385T(28437) – Spring 2013 – Lecture 4 Manages features and tables inside a database management system • File geodatabase • stores datasets in a folder of files • each dataset file up to 1 TB in size • can be used across platforms • can be compressed and encrypted for read-only, secure use
Geodatabase types INF385T(28437) – Spring 2013 – Lecture 4 • Personal geodatabase • stores datasets in a Microsoft Access .mdb file • storage sizes between 250 and 500 MB • limited to 2GB • only supported on Windows • ArcSDE geodatabase • stores datasets in a number of optional DBMSs: • IBM DB2, IBM Informix , Microsoft SQL Server , Oracle, or PostgreSQL • unlimited size and users
New file geodatabase INF385T(28437) – Spring 2013 – Lecture 4 ArcCatalog
Import into geodatabase • Shapefile features INF385T(28437) – Spring 2013 – Lecture 4
Import into geodatabase INF385T(28437) – Spring 2013 – Lecture 4 Tables
Export from geodatabase INF385T(28437) – Spring 2013 – Lecture 4
View geodatabases INF385T(28437) – Spring 2013 – Lecture 4 Cannot identify names in Windows Explorer Must use ArcCatalog
Compact geodatabases INF385T(28437) – Spring 2013 – Lecture 4 • File and personal geodatabases • Reduces size and improves performance • Compact personal geodatabases > 250 MB. • Geodatabases with frequent data entry, deletion, or general editing • Open geodatabases in ArcMap cannot be compacted • remove any layers with a source table or feature class in that database from the TOC
Compress geodatabases INF385T(28437) – Spring 2013 – Lecture 4 • File geodatabases • Once compressed, a feature class or table is read-only and cannot be edited • Compression is ideally suited to mature datasets that do not require further editing • Compressed dataset can be uncompressed to return it to its original, read-write format
Lecture 4 Data table joins INF385T(28437) – Spring 2013 – Lecture 4
Data table joins INF385T(28437) – Spring 2013 – Lecture 4 Putting two tables together to make one table Join two tables one-to-one by row Must have the same values and data types
Join example INF385T(28437) – Spring 2013 – Lecture 4 • Housing heating fuel study for U.S. Counties • Source: U.S. Census • Data table: Census SF3 table for heating fuel by county • Map Features: County polygons
Data table INF385T(28437) – Spring 2013 – Lecture 4 • Heating fuel table (Excel spreadsheet)
Data table INF385T(28437) – Spring 2013 – Lecture 4 • Heating fuel table data dictionary • H040001: Occupied housing units: House heating fuel; TOTAL Units • H040002: Occupied housing units: House heating fuel; Utility gas • H040003: Occupied housing units: House heating fuel; Bottled; tank; or LP gas • H040004: Occupied housing units: House heating fuel; Electricity • H040005: Occupied housing units: House heating fuel; Fuel oil; kerosene; etc. • H040006: Occupied housing units: House heating fuel; Coal or coke • H040007: Occupied housing units: House heating fuel; Wood • H040008: Occupied housing units: House heating fuel; Solar energy • H040009: Occupied housing units: House heating fuel; Other fuel • H040010: Occupied housing units: House heating fuel; No fuel used
Feature class INF385T(28437) – Spring 2013 – Lecture 4 County polygons
Add data and features to map INF385T(28437) – Spring 2013 – Lecture 4
Open attribute tables INF385T(28437) – Spring 2013 – Lecture 4 Find common attribute to join
Data problem INF385T(28437) – Spring 2013 – Lecture 4 FIPS has leading zero and is a TEXT field. GEO_ID2 is a NUMBER fieldwith no leading zeros.
Data solution INF385T(28437) – Spring 2013 – Lecture 4 Make a new NUMBER field in Counties attribute table and use field calculator to populate new field from old
Data solution INF385T(28437) – Spring 2013 – Lecture 4 New FIPS_NUM is same as GEO_ID2 and ready to join
Join tables INF385T(28437) – Spring 2013 – Lecture 4
Join result INF385T(28437) – Spring 2013 – Lecture 4 Heating fuel data is now listed for every county in the USCounties feature attribute table
Permanent joins INF385T(28437) – Spring 2013 – Lecture 4 Joins are temporary and can be removed Export data to make joins permanent
Choropleth map result INF385T(28437) – Spring 2013 – Lecture 4
Lecture 4 Spatial joins INF385T(28437) – Spring 2013 – Lecture 4
Spatial join example INF385T(28437) – Spring 2013 – Lecture 4 You have census block group centroids with housing fuel data You want to know housing fuel data by neighborhoods No attributes in common Spatial join needed
Spatial joins INF385T(28437) – Spring 2013 – Lecture 4 • Points to polygons • Spatially joins points (block centroids) within polygons (neighborhoods) • Joins using “shape” (not attribute field)
Spatial joins INF385T(28437) – Spring 2013 – Lecture 4 Right click polygon layer (neighborhoods)
Join result INF385T(28437) – Spring 2013 – Lecture 4 New polygon feature
Join result INF385T(28437) – Spring 2013 – Lecture 4 Counts and sums
Count result INF385T(28437) – Spring 2013 – Lecture 4 Number of points in each polygon
Sum result INF385T(28437) – Spring 2013 – Lecture 4 • Every block group centroid has associated data • (e.g. H040004, heating electricity shown in labels)
Sum result INF385T(28437) – Spring 2013 – Lecture 4 • One neighborhood example • Central business district • 4 block groups • Housing units with electricity fuel (80 + 299 + 128 + 292 ) • Sum = 799
Choropleth map result (sum) INF385T(28437) – Spring 2013 – Lecture 4
Choropleth map result (sum) INF385T(28437) – Spring 2013 – Lecture 4
Other spatial joins INF385T(28437) – Spring 2013 – Lecture 4 • Polygons to points • Example: ATM robberies (points) need neighborhood name
Polygon to point join result INF385T(28437) – Spring 2013 – Lecture 4 Neighborhood name shows on each point
Other spatial joins INF385T(28437) – Spring 2013 – Lecture 4 • Points to points • Example: What is the distance of a burglary to the nearest commercial property?
Point to point join result INF385T(28437) – Spring 2013 – Lecture 4 Distance to nearest commercial property shows on each burglary point
Lecture 4 Field calculator (as in “Feature-Attribute” Calculator) INF385T(28437) – Spring 2013 – Lecture 4
Sample functions INF385T(28437) – Spring 2013 – Lecture 4 Performs numeric calculations Populates field Concatenates textdata
Field calculator functions INF385T(28437) – Spring 2013 – Lecture 4 Calculate acres to square miles
Field calculator functions INF385T(28437) – Spring 2013 – Lecture 4 Populate field with county name
Field calculator functions INF385T(28437) – Spring 2013 – Lecture 4 Concatenate house number and street fields