Chapter6 - SLCC Geog 1800

Download Report

Transcript Chapter6 - SLCC Geog 1800

Return to Outline
Chapter 6
Spatial Joins
6-1
Copyright © 2009 by Maribeth H. Price
Return to Outline
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
6-2
Copyright © 2009 by Maribeth H. Price
Return to Outline
What is a spatial join?
6-3
Copyright © 2009 by Maribeth H. Price
Return to Outline
Attribute joins
Destination table
Source table
Join tables on
common field
Joined table
Copyright © 2009 by Maribeth H. Price
6-4
Return to Outline
Spatial joins
Destination feature class
cities
Source feature class
airports
cities2
Output feature class
Copyright © 2009 by Maribeth H. Price
6-5
Return to Outline
Spatial Join Conditions
• Join two tables based on a common
spatial relationship
– One feature inside another
– One feature closest to another
6-6
Copyright © 2009 by Maribeth H. Price
Return to Outline
Unique values map by airport
A distance spatial join appends
records based on which source
feature (airport) is closest to the
destination feature (city.)
6-7
Copyright © 2009 by Maribeth H. Price
Graduated symbol map by distance
Return to Outline
An inside join appends
the record of the source
feature (geology) to the
destination feature
(septic) that falls inside.
6-8
Copyright © 2009 by Maribeth H. Price
Return to Outline
Cardinality
6-9
Copyright © 2009 by Maribeth H. Price
What 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.
Return to Outline
Unique values map by airport
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.
6-10
Copyright © 2009 by Maribeth H. Price
Return to Outline
Many city records become a single
record containing some statistics,
which can then be joined to the airport.
Airports to cities
One to many
And you could map the
airports based on
population served.
6-11
Copyright © 2009 by Maribeth H. Price
Return to Outline
Summarized joins
Airports and cities
Counties and schools
• Summarized joins are
used to handle one-tomany 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.
6-12
Copyright © 2009 by Maribeth H. Price
Return to Outline
Spatial Join Cardinality
• Simple joins
The Rule of Joining applies
to spatial joins also!
– One-to-one or many-to-one cardinality
• Summarized joins
– One-to-many or many-to-many
6-13
Copyright © 2009 by Maribeth H. Price
Return to Outline
Simple spatial join
One-to-one or manyto-one. No ambiguity
in assigning fields.
6-14
Copyright © 2009 by Maribeth H. Price
Return to Outline
Summarized join
Destination 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,
6-15
to sum
thebytotal
number
of students in each county.
Copyright
© 2009
Maribeth
H. Price
Return to Outline
Point to point joins
Distance joins
only
Simple?
or
Summarized?
Depends on the
question being
asked…
Which attraction is closest to each hotel?
Enforces a one to one cardinality…
How many attractions are closer to one hotel than another?
One to many cardinality…must use summarize
Copyright © 2009 by Maribeth H. Price
6-16
Return to Outline
Types of spatial joins
6-17
Copyright © 2009 by Maribeth H. Price
Return to Outline
Simple
Summarized
Inside
Schools  Counties
Which county is each school in?
Counties  Schools
How many schools in each of
the counties?
Distance
Hotels  Attractions
Which attraction is closest to
each hotel? How far is it?
Copyright © 2009 by Maribeth H. Price
Hotels  Attractions
How many attractions are
closest to each hotel?
6-18
Return to Outline
Feature geometry and spatial
joins
6-19
Copyright © 2009 by Maribeth H. Price
Return to Outline
Points to Polygons
Join each county to the
hospital that is nearest it.
Each county features gets
name of closest hospital
and the distance.
6-20
Copyright © 2009 by Maribeth H. Price
Return to Outline
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.
Copyright © 2009 by Maribeth H. Price
Pennington County
has three hospitals all
with a distance of
zero, so one is
randomly chosen to
match.
6-21
Return to Outline
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.
6-22
Copyright © 2009 by Maribeth H. Price
Return to Outline
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.
6-23
Copyright © 2009 by Maribeth H. Price
Return to Outline
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.
6-24
Copyright © 2009 by Maribeth H. Price
Return to Outline
Several possible combinations
Geometry
Type
Points to
Points
Lines to Points
Polygons to
Points
Join Type
Example
Simple distance
Find the hospital closest to each town.
Summarized
distance
Find all the towns closer to one hospital
than to any other hospital.
Simple distance
Find the water main closest to the
proposed building site.
Summarized
inside
Find the total voltage of all electric lines
meeting at a substation.
Simple inside
Find the soil type that underlies each gas
station.
Simple distance
Find the lake that is closest to each
campground.
Copyright © 2009 by Maribeth H. Price
6-25
Return to Outline
Points to Points
Destination: hospitals
• 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.
6-26
Copyright © 2009 by Maribeth H. Price
Return to Outline
Polygons to Points
Destination: hospitals
• 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.
6-27
Copyright © 2009 by Maribeth H. Price
Return to Outline
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.
6-28
Copyright © 2009 by Maribeth H. Price
Return to Outline
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
Copyright © 2009 by Maribeth H. Price
6-29
Return to Outline
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.
6-30
Copyright © 2009 by Maribeth H. Price
Return to Outline
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!
6-31
Copyright © 2009 by Maribeth H. Price
Return to Outline
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.
6-32
Copyright © 2009 by Maribeth H. Price
Return to Outline
Coordinate systems and
distance joins
6-33
Copyright © 2009 by Maribeth H. Price
Return to Outline
Source coordinate system
Look again at the join of
hospitals to counties. What
happens if the source layers
are in a GCS?
6-34
Copyright © 2009 by Maribeth H. Price
Return to Outline
Distance join units
The source data
was in a GCS with
units of decimal
degrees.
• 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… 6-35
Copyright © 2009 by Maribeth H. Price
Return to Outline
Distance joins and the CS
A
A
B
C
Distance join with GCS source
B
C
Distance join with UTM source
Use source data with a projection that conserves distance!
• Using a GCS or distorted projection may yield
incorrect results.
6-36
Copyright © 2009 by Maribeth H. Price
Return to Outline
Beware
The data frame
coordinate system may
be different from the
source data coordinate
system.
SD State Plane
Projected on the fly
GCS
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.
6-37
Copyright © 2009 by Maribeth H. Price
Return to Outline
About ArcGIS
Chapter 6.
Spatial Joins
6-38
Copyright © 2009 by Maribeth H. Price
Return to Outline
Choosing the join type
6-39
Copyright © 2009 by Maribeth H. Price
Return to Outline
How to join
Right-click destination table
Set Join type to spatial
Choose source table
Choose join type
Specify output file
Copyright © 2009 by Maribeth H. Price
6-40
Return to Outline
Two choices
Based 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.
6-41
Copyright © 2009 by Maribeth H. Price
Return to Outline
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!
6-42
Copyright © 2009 by Maribeth H. Price
Return to Outline
Setting up spatial joins
6-43
Copyright © 2009 by Maribeth H. Price
Return to Outline
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?
6-44
Copyright © 2009 by Maribeth H. Price
Return to Outline
Example #1
• Find all congressional districts that have
had more than 10 earthquake deaths.
6-45
Copyright © 2009 by Maribeth H. Price
•
•
•
•
•
Return to Outline
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?
6-46
Copyright © 2009 by Maribeth H. Price
Return to Outline
Example #2
• Develop a pollution risk index for rivers
based on the total number of people in the
adjacent counties.
6-47
Copyright © 2009 by Maribeth H. Price
•
•
•
•
•
Return to Outline
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?
6-48
Copyright © 2009 by Maribeth H. Price
Return to Outline
Example #3
• Create a table showing the volcano
closest to each city in the US
6-49
Copyright © 2009 by Maribeth H. Price
•
•
•
•
•
tolook?
Outline
How do I want theReturn
output to
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?
Students can find
volcano closest to
their city.
Or can they? Look at
the distances…
Copyright © 2009 by Maribeth H. Price
6-50