Lecture 4 Geodatabases Geodatabases Outline Data types Geodatabases Data table joins Spatial joins Field calculator Calculate geometry ArcCatalog functions INF385T(28437) – Spring 2013 – Lecture 4 2 Lecture 4 DATA TYPES INF385T(28437) – Spring 2013 – Lecture 4 3 Directly loadable data types dBase (.dbf) Text with comma (.csv) or tab-separated values (.txt) Microsoft Access (.mdb) Microsoft Excel (.xls) INF385T(28437) – Spring 2013 – Lecture 4 4 Data table formats 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 INF385T(28437) – Spring 2013 – Lecture 4 5 Lecture 4 GEODATABASES INF385T(28437) – Spring 2013 – Lecture 4 7 Geodatabase types 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 INF385T(28437) – Spring 2013 – Lecture 4 8 Geodatabase types 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 INF385T(28437) – Spring 2013 – Lecture 4 9 New file geodatabase ArcCatalog INF385T(28437) – Spring 2013 – Lecture 4 10 Import into geodatabase Shapefile features INF385T(28437) – Spring 2013 – Lecture 4 11 Import into geodatabase Tables INF385T(28437) – Spring 2013 – Lecture 4 12 Export from geodatabase INF385T(28437) – Spring 2013 – Lecture 4 13 View geodatabases Cannot identify names in Windows Explorer Must use ArcCatalog INF385T(28437) – Spring 2013 – Lecture 4 14 Compact geodatabases 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 INF385T(28437) – Spring 2013 – Lecture 4 15 Compress geodatabases 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 INF385T(28437) – Spring 2013 – Lecture 4 16 Lecture 4 DATA TABLE JOINS INF385T(28437) – Spring 2013 – Lecture 4 17 Data table joins Putting two tables together to make one table Join two tables one-to-one by row Must have the same values and data types INF385T(28437) – Spring 2013 – Lecture 4 18 Join example 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 INF385T(28437) – Spring 2013 – Lecture 4 19 Data table Heating fuel table (Excel spreadsheet) INF385T(28437) – Spring 2013 – Lecture 4 20 Data table 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 INF385T(28437) – Spring 2013 – Lecture 4 21 Feature class County polygons INF385T(28437) – Spring 2013 – Lecture 4 22 Add data and features to map INF385T(28437) – Spring 2013 – Lecture 4 23 Open attribute tables Find common attribute to join INF385T(28437) – Spring 2013 – Lecture 4 24 Data problem FIPS has leading zero and is a TEXT field. FIPS 01001 01003 01005 01007 GEO_ID2 is a NUMBER field with no leading zeros. GEO_ID2 1001 1003 1005 1007 INF385T(28437) – Spring 2013 – Lecture 4 25 Data solution Make a new NUMBER field in Counties attribute table and use field calculator to populate new field from old INF385T(28437) – Spring 2013 – Lecture 4 26 Data solution New FIPS_NUM is same as GEO_ID2 and ready to join INF385T(28437) – Spring 2013 – Lecture 4 27 Join tables INF385T(28437) – Spring 2013 – Lecture 4 28 Join result Heating fuel data is now listed for every county in the USCounties feature attribute table INF385T(28437) – Spring 2013 – Lecture 4 29 Permanent joins Joins are temporary and can be removed Export data to make joins permanent INF385T(28437) – Spring 2013 – Lecture 4 30 Choropleth map result INF385T(28437) – Spring 2013 – Lecture 4 31 Lecture 4 SPATIAL JOINS INF385T(28437) – Spring 2013 – Lecture 4 32 Spatial join example 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 INF385T(28437) – Spring 2013 – Lecture 4 33 Spatial joins Points to polygons Spatially joins points (block centroids) within polygons (neighborhoods) Joins using “shape” (not attribute field) INF385T(28437) – Spring 2013 – Lecture 4 34 Spatial joins Right click polygon layer (neighborhoods) INF385T(28437) – Spring 2013 – Lecture 4 35 Join result New polygon feature INF385T(28437) – Spring 2013 – Lecture 4 36 Join result Counts and sums INF385T(28437) – Spring 2013 – Lecture 4 37 Count result Number of points in each polygon INF385T(28437) – Spring 2013 – Lecture 4 38 Sum result Every block group centroid has associated data (e.g. H040004, heating electricity shown in labels) INF385T(28437) – Spring 2013 – Lecture 4 39 Sum result One neighborhood example Central business district 4 block groups Housing units with electricity fuel (80 + 299 + 128 + 292 ) Sum = 799 INF385T(28437) – Spring 2013 – Lecture 4 40 Choropleth map result (sum) INF385T(28437) – Spring 2013 – Lecture 4 41 Choropleth map result (sum) INF385T(28437) – Spring 2013 – Lecture 4 42 Other spatial joins Polygons to points Example: ATM robberies (points) need neighborhood name INF385T(28437) – Spring 2013 – Lecture 4 43 Polygon to point join result Neighborhood name shows on each point INF385T(28437) – Spring 2013 – Lecture 4 44 Other spatial joins Points to points Example: What is the distance of a burglary to the nearest commercial property? INF385T(28437) – Spring 2013 – Lecture 4 45 Point to point join result Distance to nearest commercial property shows on each burglary point INF385T(28437) – Spring 2013 – Lecture 4 46 Lecture 4 FIELD CALCULATOR (as in “Feature-Attribute” Calculator) INF385T(28437) – Spring 2013 – Lecture 4 47 Sample functions Performs numeric calculations Populates field Concatenates text data INF385T(28437) – Spring 2013 – Lecture 4 48 Field calculator functions Calculate acres to square miles INF385T(28437) – Spring 2013 – Lecture 4 49 Field calculator functions Populate field with county name INF385T(28437) – Spring 2013 – Lecture 4 50 Field calculator functions Concatenate house number and street fields INF385T(28437) – Spring 2013 – Lecture 4 51 Lecture 4 CALCULATE GEOMETRY INF385T(28437) – Spring 2013 – Lecture 4 52 Polygon/point centroids Advanced calculations for finding a polygon’s point centroid INF385T(28437) – Spring 2013 – Lecture 4 53 Calculate XY fields Add new X and Y fields in the attribute table INF385T(28437) – Spring 2013 – Lecture 4 54 Calculate XY fields Calculate geometry for X field, repeat for Y INF385T(28437) – Spring 2013 – Lecture 4 55 XY field results Results are X and Y values based on map properties (e.g. Long/Lat or XY feet) INF385T(28437) – Spring 2013 – Lecture 4 56 Export as shapefile XY events should be exported as permanent shapefile or feature class INF385T(28437) – Spring 2013 – Lecture 4 59 Lecture 4 ARCCATALOG FUNCTIONS INF385T(28437) – Spring 2013 – Lecture 4 63 Basic functions Copy, paste, rename, etc. INF385T(28437) – Spring 2013 – Lecture 4 64 View and edit properties Projections, fields, etc. INF385T(28437) – Spring 2013 – Lecture 4 65 View metadata INF385T(28437) – Spring 2013 – Lecture 4 66 Edit metadata INF385T(28437) – Spring 2013 – Lecture 4 67 Create new files Geodatabases, tables, features, etc. INF385T(28437) – Spring 2013 – Lecture 4 68 Summary Data types Geodatabases Data table joins Spatial joins Field calculator Calculate geometry ArcCatalog functions INF385T(28437) – Spring 2013 – Lecture 4 69