You are on page 1of 5

GIS Relational Databases - Joins and Relates

2011 Charlie Schweik Note: This work is licensed under the Creative Commons AttributionAttributionNonCommercialNonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/. http://creativecommons.org/licenses/by-nc-

Relational Databases
Store data in multiple two-dimensional tables Like flat-files, but easier to extract information from multiple files at one time Tables are related--they share common elements or keys Basic operations (in ArcGIS):
Select (query) Joining tables Relating tables

Popular PC software: Access, Foxpro, Paradox, Oracle, ArcGIS geodatabase uses Access

Common GIS Database Situations


Attribute table and external data (e.g., excel, access) have 1-1 relationship Attribute table and external data have 1-toMany relationship Attribute table and external data have Many-to-1 relationship Attribute table and external data have Many to-Many relationship

Types of Table Relationships in GIS


1-GIS Feature to 1-external data row relationships (1:1)
Use ArcMap JOIN

1-GIS Feature to-Many external data row relationships (1:Many)


Use ArcMap RELATE

Many GIS features-to-1 external data row relationships (Many:1)


Use ArcMap JOIN

Many GIS features-to-Many external data row relationships (Many:Many)


One building (e.g., a Mall) could have many tenants (e.g., Sears, J.C. Penny, etc). One tenant (Sears) could be in multiple buildings across the landscape. Use ArcMap RELATE

An example of 1:1 relationship


(e.g., a 1 GIS layer - 1 Excel record relationship) ArcMap - JOIN
FID 1 2 3 4 5 Building # 1 2 3 4 5 Building # # rooms 1 14 2 3 4 5 20 53 124 6
Handicap accessible Parking?

Y N Y Y N

Y Y Y Y N

GIS Building point attribute table

Data collected in excel spreadsheet


5

An example of a 1- Many relationship 1(1 GIS feature, Many associated Excel rows) Use ArcMap RELATE
Town Amherst Hadley
Town-ID Town-ID

Month

Road repair Expenditures

1 2

2 2 1 1 2

Jan 05 $24,000 Feb 05 $14,000 Jan 05 $12,000 Feb 05 $16,000 Mar 05 $30,000

Town GIS polygon layer

Excel road maintenance expenditures Example: Mass Department of Transportation GIS

An example of a Many 1
(1 GIS feature - 1 excel record relationship) Use ArcMap JOIN
Building ID Code
Landuse

1 2 3 4 5

A A F F A

Landuse code

Landuse Forest Agriculture

F A

Legend data

GIS landuse polygon attribute table

An example of a Many Many


(Many GIS features - Many excel records) Use ArcMap RELATE
Building ID

1 2 3 4 5 GIS Building Polygon

Tenant ID

Name Sears Target Big Y

A B C

Tenant Excel

Note: Many-to-Many relationships are complicated we dont have time to cover it. It requires linking tables. I recommend you try to keep to 1-M or M-1 relationships but if you need this, ArcMap can handle this situation. See help in ArcMap, Working with 8 Tables.

Join and Relate exercises we will do


JOIN (1:1 or Many:1)
Many GIS features to 1 external data row Symbolize the Hadley landuse layer using some legend data from MassGIS Many to 1 relationship Many landuse polygons have the same legend entry (e.g., forest, agriculture)

RELATE (1:many or many to many)


One GIS feature to many excel rows Forest stand polygons and experimental burn treatments
9

Relates in ArcGIS
Relates let you associate data with the layer The associated data isnt appended to the layers attribute data like it is for a join. Instead you can access the related data when you work with this layers attributes and vise versa, if a relate is established.
10

You might also like