return to outline copyright © 2009 by maribeth h. price 6-1 chapter 6 spatial joins

50
Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Upload: lora-briggs

Post on 19-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-1

Chapter 6

Spatial Joins

Page 2: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-2

Outline

• GIS Concepts– What is a spatial join?– Cardinality– Types of spatial joins– Feature geometry and spatial joins– Coordinate systems and distance joins

• About ArcGIS– Choosing the join type– Setting up spatial joins

Page 3: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-3

What is a spatial join?

Page 4: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-4

Attribute joins

Join tables on common field

Joined table

Destination table Source table

Page 5: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-5

Spatial joins

cities airports

cities2

Destination feature class Source feature class

Output feature class

Page 6: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-6

Spatial Join Conditions

• Join two tables based on a common spatial relationship– One feature inside another– One feature closest to another

Page 7: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-7

Unique values map by airport

Graduated symbol map by distance

A distance spatial join appends records based on which source feature (airport) is closest to the destination feature (city.)

Page 8: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-8

An inside join appends the record of the source feature (geology) to the destination feature (septic) that falls inside.

Page 9: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-9

Cardinality

Page 10: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-10

Unique values map by airportWhat if you switch the destination to airports and the source to cities? Each airport is serving many cities and the cardinality is now one to many. The Rule of Joining is violated and no join is possible.

If you could instead use Summarize to group the cities according to the airport they served, and summed the population, you would get a table like this. Now every airport has one record.

You can do this with a summarized join.

Page 11: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-11

Airports to citiesOne to many

Many city records become a single record containing some statistics, which can then be joined to the airport.

And you could map the airports based on population served.

Page 12: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-12

Summarized joins

• Summarized joins are used to handle one-to-many relationships.

• They determine the spatial relationship, summarize the source features that match each destination feature, and then append the summarized statistics record to the destination feature.

Airports and cities

Counties and schools

Page 13: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-13

Spatial Join Cardinality

• Simple joins– One-to-one or many-to-one cardinality

• Summarized joins– One-to-many or many-to-many

The Rule of Joining applies to spatial joins also!

Page 14: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-14

Simple spatial join

One-to-one or many-to-one. No ambiguity in assigning fields.

Page 15: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-15

Summarized joinDestination table is counties.

Source table is schools.

Output table gives total schools located in each county.

Count field is always generated automatically.

User can optionally choose a statistic to calculate, for example, to sum the total number of students in each county.

Page 16: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-16

Which attraction is closest to each hotel?

How many attractions are closer to one hotel than another?

Point to point joins Distance joins only

Simple?

or

Summarized?

Depends on the question being asked…

Enforces a one to one cardinality…

One to many cardinality…must use summarize

Page 17: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-17

Types of spatial joins

Page 18: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-18

Simple Summarized

Inside

Distance

Schools Counties

Which county is each school in?

Hotels Attractions

Counties Schools

How many attractions are closest to each hotel?

Which attraction is closest to each hotel? How far is it?

How many schools in each of the counties?

Hotels Attractions

Page 19: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-19

Feature geometry and spatial joins

Page 20: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-20

Points to Polygons

Join each county to the hospital that is nearest it.

Each county features gets name of closest hospital and the distance.

Page 21: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-21

Note on polygon distances

In measuring distances for polygons, the center of the polygon is used. For each of the counties, the centroid of the county is closest to the hospital.

If the county contains a hospital, the distance is zero.

Pennington County has three hospitals all with a distance of zero, so one is randomly chosen to match.

Page 22: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-22

Points to Lines

In this example we wish to evaluate impact of septic systems on various streams based on distance.

Streams is the destination. Each point represents one or more septic systems. We find the number of septic points closest to each stream segment, and summarize the totals.

Page 23: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-23

Feature types

• Every join involves two geometry types– Points to points– Polygons to lines– Lines to points, etc.

• Each combination offers two possible join types.– One is usually a simple join, the other is

summarized.

Page 24: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-24

Note

• In the next examples, we break with our usual convention and put the destination layer on the right.

• This is done to match the convention used in the ArcGIS join menu.

• The destination table is shown in boldface.

Page 25: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-25

Geometry Type

Join Type Example

Points to Points

Simple distance Find the hospital closest to each town.

Summarized distance

Find all the towns closer to one hospital than to any other hospital.

Lines to Points

Simple distanceFind the water main closest to the

proposed building site.

Summarized inside

Find the total voltage of all electric lines meeting at a substation.

Polygons to Points

Simple insideFind the soil type that underlies each gas

station.

Simple distanceFind the lake that is closest to each

campground.

Several possible combinations

Page 26: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-26

Points to Points

• Simple distance – Find the source

feature that is the closest to the destination feature.

– Find the hospital closest to each town.

• Summarized distance – Summarize the

attributes of all the source features that are closer to the destination feature than to any other.

– Find all the towns closer to one hospital than to any other hospital.

Destination: hospitals

Page 27: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-27

Polygons to Points

• Simple distance – Find the county that is

closest to each hospital and give the hospital the county attributes.

• Simple inside – Find the county that

each hospital is inside and give the hospital that county’s attributes.

Destination: hospitals

Page 28: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-28

Polygons to Lines

• Simple distance – Find the park that is

closest to each road and give the road the park attributes.

• Summarized inside – Give the interstate the

total population of all the counties that it crosses.

Page 29: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-29

Beware and think…

Some choices don’t make sense for particular layers.

Finding the closest county to each river has no meaning here.

Finding the county a river is inside does have meaning…BUT

…some rivers cross county lines.

We’ll return to this issue in the next chapter.

Destination layer: rivers

Page 30: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-30

Polygons to Polygons

• Simple inside – Give each urban area

the attributes of the county that it falls inside.

• Summarized inside – Give each county the

summarized attributes of the urban areas that fall inside it.

Notice that in this case we need to switch the destination layer for the join to make sense.

Page 31: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-31

Polygons to Polygons

• Simple inside – Find the park that

each lake is inside and give the lake the attributes of the park.

• Summarized inside – Give the park the total

area of all the lakes that fall inside it.

Notice that in this case we need to switch the destination layer for the join to make sense.

Also notice that some lakes do not fall cleanly inside one park or another. Not all joins are capable of giving valid results. Think!

Page 32: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-32

More options

• These examples are only a few of the possible combinations—the rest are shown in your text.

• If this seems complicated, don’t worry. ArcGIS figures out the two possibilities for you and presents you with a choice…one usually makes sense after a little thought.

Page 33: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-33

Coordinate systems and distance joins

Page 34: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-34

Source coordinate system

Look again at the join of hospitals to counties. What happens if the source layers are in a GCS?

Page 35: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-35

Distance join units

• Distances are given in stored map units• Decimal degrees cannot be easily converted to

miles or km because the conversion factor varies with latitude

• Better to use a projected coordinate system…

The source data was in a GCS with units of decimal degrees.

Page 36: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-36

Distance joins and the CS

• Using a GCS or distorted projection may yield incorrect results.

A B

C

A B

C

Use source data with a projection that conserves distance!

Distance join with GCS source Distance join with UTM source

Page 37: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-37

Beware

GCS

Projected on the fly

The data frame coordinate system may be different from the source data coordinate system.

Setting the data frame CS is not enough to fix the problem.

You must project the source data using the Project tool (Chapter 11) and do the join again.

SD State Plane

Page 38: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-38

About ArcGIS

Chapter 6.

Spatial Joins

Page 39: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-39

Choosing the join type

Page 40: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-40

How to join

Right-click destination table

Set Join type to spatial

Choose source table

Choose join type

Specify output file

Page 41: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-41

Two choicesBased on the two geometries and the destination, ArcMap picks the possible two join types.

You just need to pick the right one.

Usually one is simple and one is summarized.

Page 42: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-42

Choosing summary statistics

Unlike the Summarize command that pairs stats with specific fields, in joins you only pick the type(s) of statistics.

A new stats field will be generated for every numeric field in the table.

Choose only what you need—or your output may have too many fields!

Page 43: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-43

Setting up spatial joins

Page 44: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-44

Setting up a join

• Sketch the layers

• How do I want the output layer/table to look?

• Which is the destination layer?

• Is this a distance join or an inside join?

• What is the cardinality?

• Do I need a simple join or a summarized join?

Page 45: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-45

Example #1

• Find all congressional districts that have had more than 10 earthquake deaths.

Page 46: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-46

• How do I want the output to look?• Which is the destination layer?• Is this a distance join or an inside join?• What is the cardinality?• Do I need a simple join or a summarized

join?

Page 47: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-47

Example #2

• Develop a pollution risk index for rivers based on the total number of people in the adjacent counties.

Page 48: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-48

• How do I want the output to look?• Which is the destination layer?• Is this a distance join or an inside join?• What is the cardinality?• Do I need a simple join or a summarized

join?

Page 49: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-49

Example #3

• Create a table showing the volcano closest to each city in the US

Page 50: Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins

Return to Outline

Copyright © 2009 by Maribeth H. Price

6-50

Students can find volcano closest to their city.

• How do I want the output to look?• Which is the destination layer?• Is this a distance join or an inside join?• What is the cardinality?• Do I need a simple join or a summarized

join?

Or can they? Look at the distances…