Lec_8_Intro to Join and Relate

19
Intro to Join and Relate Prof. Dr. Sajid Rashid Ahmad [email protected] Atiqa Ijaz Khan _ Demonstrator [email protected]

Transcript of Lec_8_Intro to Join and Relate

Intro to Join and Relate

Prof. Dr. Sajid Rashid Ahmad

[email protected]

Atiqa Ijaz Khan _ Demonstrator

[email protected]

JOIN

(ArcGIS 10.1)

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

2

Need for Join…!

• Most database design guidelines promote organizing your database into multipletables — each focused on a specific topic — instead of one large table containingall the necessary fields.

• Having multiple tables prevents duplicating information in the database, becauseyou store the information only once in one table.

• When you need information that isn't in the current table, you can link the twotables together.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

3

With the help of ArcGIS

• ArcGIS allows to join or relate the records from a layer to a table etc.

• This can be done using a “Key” said to be the “Primary Key”.

• Joining can only be done, if one is having atleast one “Common Field” in both ofthem.

• This is only temporarily.

• And it is stored only when one saves the Arc Map document. (.mxd)

• If one doesn’t store the Arc Map document, it will show NO join, next time openedwith the same file.

• Otherwise, “Export” the file with the records for being permanent.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

4

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

5

Joining on the basis of

Common Field

Join in Arc GIS

• The input and target table should be either in the same directory or saved withrelative paths in order to establish the relationship on next opening of Arc Map.

• Otherwise, Repair the paths to re-new the relationship.

• The common field MUST have the “Same Data Type”.

• It is not necessary to have the same field name.

• It could have following relationships:

• One to one

• Many to one

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

6

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

7

Above:

One-to-one Relationship

Lower:

Many-to-one Relationship

Types of Join

• It could be join on the basis of:

• Non-spatial information (Attribute data)

• On the basis of common field or attribute data.

• With another layer or with table (Excel or Text file)

• Having common key or primary key.

• Spatial information (Locational data)

• All of the shapefiles can be joined with each other.

• Point to Line to Polygon (vice versa and within each other)

• All of the pairs are given different options.

• It will create new output file for every join.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

8

Options available within Spatial join of Data in Arc GIS

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

9

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

10LEFT:

Attribute Data (From

table)

RIGHT:

Locational Data (From

another layer)

Managing & Removing Joined Tables

• Managing Tables

• Right-click a layer or table in the table of contents and click Properties. Click theJoins & Relates tab.

• All the joins for the layer or table are listed on the left side of the dialog box. Youcan add new joins, remove existing ones, and view properties about the joins.

• Removing Tables

• In the table of contents, right-click the layer containing a join you want to remove.

• You can also click the Options button on an open table window.Point to Joins and Relates, point to Remove Join(s), and click the join you want toremove.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

11

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

12

Joins & Relate

Relate in Arc GIS

• One table can only be joined with one layer at a time.

• One can keep:

• All Records, or (Default option)

• Only matching Records

• One can remove Join, anytime one wants.

• Join does not alter the original table.

• All the attribute operations are valid upon the fields that are joined together.

• As the joined table simply can be opened as “Attribute Table” in Arc Map.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

13

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

14

Above:

Keeping all records

Lower:

Keep only matching records

RELATE

(ArcGIS 10.1)

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

15

• It only represents the relationship between two classes.

• Relate does not append the data to the layers permanently like join.

• It offers two relationships:

• One to many

• Many to many

• Relates are bi-directional. That means:

• Layer and table can be accessed cross each other.

• Table will be listed under the layer.

• Layer can be accessed by the table also.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

16

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

17

How to Relate and Access it

Important Facts

• “Same Table” cannot be Relate to “Same Layer”, already Joined with that table.

• It will give error.

• Reverse can possible.

• “Same Table” can be Join to “Same Layer”, already Related with that table.

• During the “Join or Relate”, the table cannot save the edits on it. Unless it issaved with another name.

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

18

Tuesday, March 3, 2015Institute of Geology, University of the Punjab

19