Overview
• Basics
• Input, operations, and output
• Scope
• Selection
• Classification
• Dissolve
• Proximity functions and buffering
• Overlay
• Network analysis
Learning objectives
• Understand the analytical steps of input, operations, and
output
• Understand scope of operations
• Learn the basics of selection and classification
• Examine spatial selection operations
• Explore standardization and classifications approaches
• Explore spatial functions including dissolve, proximity,
buffering, and overlay
• Understand overlay challenges
• Examine network analysis
• Explore network applications including projecting, routing,
allocation/location, and geocoding
Introduction
pp.363-365
Why this matters
• GIS relies on spatial analysis
• Spatial analysis is what turns data into information
and informs decision making
• Every step in analysis has the potential for mistakes
• Important to learn basic spatial analysis in order to
conduct more advanced work
Input, operations, and output
ESRI ArcGIS Model Builder
Central Vermont Regional
Planning Commission:
Montpelier development
potential
QGIS
ArcGIS
Scope
Local – “point” to “point”
Neighborhood – adjacent
regions have input
Global – the entire input data
layer may influence output
Scope
Local – “point” to “point”
Neighborhood – adjacent
regions have input
Global – the entire input data
layer may influence output
Scope
Local – “point” to “point”
Neighborhood – adjacent
regions have input
Global – the entire input data
layer may influence output
Selection and
Classification
pp. 366-373
Selection
• Set algebra (<, >, =, <>,…)
• Boolean algebra (and, or, not,…)
• Spatial operations (topology, attributes)
Proportion of population 65+ > 15%
Set algebra
Population density > 100 pp/mi2
Set algebra on attributes
and spatial factors
Population 65+ > 15% and population
density > 100 pp/mi2
Set algebra combined with
Boolean algebra
Spatial selection operations
• Topological (e.g., in, adjacent, contains)
• Spatial attributes (e.g., state size, directionality)
• Attributes of regions (e.g., state population)
Topological Adjacency
Adjacency depends on the algorithm used!
Set operation (=)
Set operation (size > 84km2)
Spatial characteristic (size)
Topological (assessing borders) or
spatial (southern border coordinates)
Boolean operation (and)
Classification
pp. 373-383
Classification
• Classifying, recoding, reclassing…
• Manual
• Recoding
• Binary classification
• Data defined
Binary classification
Standardization
Raw Counts Standardized
Standardization Example
Raw Counts Standardized
Classification Basics
Classed Example Overview
Classed Unclassed
Pro: more control over map Pro: no decisions to make
Con: decide on # classes and classification Con: humans can have trouble reading it
Classification Approaches
• Equal interval
• Quantiles
• Natural breaks
Equal Interval
Equal Interval Choropleth
Maximum = Ramsey County = 2,961 people/mile2
Minimum = Lake of the Woods = 2.6 people/mile2
Range = Max – Min = 2,958
Classes = 5 classes
Interval = Range ÷ Classes (5) = 591.7
3 9 13 17 24 33 44 70 186
3 10 15 18 25 33 46 73 228
5 10 15 19 25 34 48 74 482
5 10 15 20 25 34 49 88 600
5 10 15 21 26 36 53 94 690
5 10 15 21 26 38 55 97 1746
7 11 16 22 26 39 56 107 2961
7 11 17 22 27 42 63 126
8 12 17 23 29 43 68 150
9 13 17 24 29 44 70 184
Quantiles
Quantile Choropleth
Units = Number of counties = 87
Classes = 5
Quantile = Units ÷ Classes(5) = 17 (approximate)
3 9 13 17 24 33 44 70 186
3 10 15 18 25 33 46 73 228
5 10 15 19 25 34 48 74 482
5 10 15 20 25 34 49 88 600
5 10 15 21 26 36 53 94 690
5 10 15 21 26 38 55 97 1746
7 11 16 22 26 39 56 107 2961
7 11 17 22 27 42 63 126
8 12 17 23 29 43 68 150
9 13 17 24 29 44 70 184
Natural Breaks
Natural Break Choropleth
3 9 13 17 24 33 44 70 186
3 10 15 18 25 33 46 73 228
5 10 15 19 25 34 48 74 482
5 10 15 20 25 34 49 88 600
5 10 15 21 26 36 53 94 690
5 10 15 21 26 38 55 97 1746
7 11 16 22 26 39 56 107 2961
7 11 17 22 27 42 63 126
8 12 17 23 29 43 68 150
9 13 17 24 29 44 70 184
Three Maps, Three Messages
Equal interval Quantiles Natural Breaks
Dissolve
pp. 384-387
Dissolve
Binary dissolve operation
Multicategory dissolve operation
Attribute aggregation while dissolving
• Dissolving involves geometry and attributes
• Geometry portion is usually straightforward
• Attribute aggregation requires care!
• Sum, average, maximum, minimum?
• What about categorical or ordinal data?
Attribute aggregation while dissolving
Proximity Functions
and Buffering
pp. 388-393
Proximity functions and buffering
• Proximity (~ distance from…)
• Buffering (~ specific distance from…)
Proximity
Buffering
Measuring distance
• Euclidean
• Manhattan
Euclidean: as the crow flies
Euclidean raster
distance
Manhattan: along grid network without backtracking
Buffer operations
• Buffers = polygons whose boundaries are defined by
distance to input layer features
• Applications
• Zoning (e.g., setbacks)
• Planning (e.g., noise control, run-off)
• Service levels (e.g., nearest fire station)
Vector buffers: simple
Points Lines Polygons
Source
(Input)
Features
Buffer
(Output)
Features
Vector buffers: complex
Inputs Simple & Dissolved
Compound Nested
Vector buffers: variable
Raster buffers
Overlay
pp. 394-409
Overlay
• Overlay is a powerful GIS function
• One of the first ways people thought about spatial
analysis
• Combines geometry and attributes
Vector overlay
Ambiguous
result
Unambiguous
result
Vector topological overlay
Overlaying polygons creates an
inherent universe polygon [ 0 ]
62
Note: The arcs ‘keep track’ of the two
separate polygons that exist before the
overlay operation is applied
1. Find intersections
2. Create topology
3. ID Arcs & Polygons
4. Link to attributes
Arc R Poly L Poly
1 A0 00
2 A1 01
3 A0 00
4 00 01
5 A0 A1
6 00 01
Overlay operations
• Dissolve/Merge
• Union
• Intersect
• Identity
• Erase
• Clip
Overlay: Dissolve
• For features sharing attributes in both 1st and 2nd
layer, removes arcs between polygons and nodes
between arcs
Overlay: Identity
• 2nd layer loses features not bounded by 1st layer
Overlay: Erase
• 1st layer is ‘erased’ or ‘masked’ by 2nd layer
Overlay: Clip
• 2nd layer is a ‘cookie cutter’ for 1st layer
Overlay: Intersect
• In a pure intersection, features from both layers
remain
Overlay: Union
• Input features from both 1st and 2nd layers remain
• Attribute values assigned by logical union
Vector overlay challenges
• Donuts and islands
• Boundaries
• Errors is polygon boundary location
• Fuzzy boundaries
• Common boundaries
• Slivers!
Fixing slivers
Are these real polygons or slivers?
Fixing slivers during build
• Replace common boundaries
• On-the-fly snapping
Fixing slivers after build
• Analyze the spatial and attribute characteristics of all
polygons in output layer
• Slivers have key characteristics
• Area: small
• Shape: elongated and/or narrow
• Number of arcs: often have only 2 bounding arcs
• (vs. 4+ in general)
• Junctions: 4-arc junctions (vs. 3 in general)
Raster overlay
• Generally easier than vector but can be tricky
• Need to…
• Account for attributes
• Keep an eye on grid size and orientation
Mismatched grid size and orientation
Raster overlay basics
Raster overlay: attributes
• Attributes are coded in cell values
• More values → more combined values
Network Analysis
pp. 410-417
Network analysis
People
Networks are Rivers
everywhere!
Roads
Network elements
Allowed turns in a
stream network
Common network analyses
• Routing
• Location/Allocation
• Network projection
• Geocoding
Courtesy Google Maps
Routing
• Routing is a common network problem
• Airlines
• Driving
• Shipping packages
• Dispatching emergency vehicles
• Shortest-path is often a goal
Courtesy Google Maps, USGS
Route selection example
Network projection
Evening rush hour Late weeknight
Courtesy Google Maps
Combining network project, routing, and
preferences
Fastest by car
Avoids major highways
Courtesy Google Maps
Allocation & location
• Allocation
• What parts of network to serve with existing centers
• Many uses
• Newspaper routes from existing plants
• Service levels and areas for fire stations
• Service areas for hospitals and clinics
• Location
• Where to place new centers on a network
• Where, what, how big?
• Many uses
• Newspaper delivery plant
• Fire stations
• Hospitals
Allocation
Location and allocation
Options for Optimal Coverage of Free C-Section Services for Poor Mothers in Indian State of Gujarat: Location Allocation Analysis Using GIS Vora KS et al.
(2015) Options for Optimal Coverage of Free C-Section Services for Poor Mothers in Indian State of Gujarat: Location Allocation Analysis Using GIS. PLOS
ONE 10(9): e0137122. [Link] Fig 4. (a & b): Current and Potential coverage to services in Dahod
Geocoding
• Locating a street address in space
• Many uses
• Emergency response (e.g., fire, police)
• Retail (e.g., marketing, advertising)
• Real estate (e.g., house & neighborhood stats)
• Criminal analysis (e.g., statistics, prediction)
• Demographic analysis (e.g., census)
• Health/human services (e.g., epidemiology)
Courtesy pedrojperez via Morguefile
Geocoding process
Geocoding challenges
• Limited coverage in rural areas
• Incorrect spatial assumptions
• Messy address information (e.g., typos, variations)
One Twenty Three Pleasant Ave
123 Pleasient Ave
US Hwy 281
PO Box 234
Spelling error!
Summary
• Basics (input, operations, and output / scope)
• Selection
• Classification
• Dissolve
• Proximity functions and buffering
• Overlay
• Network analysis
Basics
• Input, operations, and output
• Scope
Selection
• Set algebra (<, >, =, <>,…)
• Boolean algebra (and, or, not,…)
• Spatial operations (topology, attributes)
Classification
• Classifying, recoding, reclassing…
• Manual
• Data defined
Dissolve
• Various forms (e.g., binary vs. multicategory)
• Keep an eye on attributes!
Proximity Functions and Buffering
• Distance 5
4
• Proximity 3
• Buffering 2
1
Overlay
• Overlays are powerful GIS functions
• Combines geometry and attributes
• Vector
• Raster
• Kinds
• Dissolve/Merge
• Union
• Intersect
• Identity
• Erase
• Clip
Network Analysis
• Network elements (e.g., links, nodes, centers…)
• Common network analyses
• Routing
• Network projection
• Location/allocation
• Geocoding
Extra Slides
These slides go into greater depth or breadth on
various aspects of the chapter.
Introduction
pp.363-365
Selection and
Classification
pp. 366-383
Topological Containment
Dissolve
pp. 384-387
Attribute aggregation in a dissolve
Parcels Data
I have parcel data with value for the parcel and school district
boundaries. I want to aggregate (dissolve) by School District to get
average value per acre for parcels.
Parcels Data
Table has
1)Total Parcel Value, 2) School District, 3) ParcelArea, 4)Value Per acre
How do I calculate average land value per acre, given this table?
This is an aggregation problem (dissolve with statistics)
I want to aggregate (dissolve) by School District to get average
value per acre
Then select
statistical operation
First Select
Variable Field
Which to choose?
This, to get average value This, plus divide by total area,
of existing parcels to get average value
per square area of all land
Another similar example
Proximity Functions
and Buffering
pp. 388-393
Overlay
pp. 394-409
Network Analysis
pp. 410-417
Vector Deep Dive
Why are vector operations slow?
Does polygon A intersect/overlap/overlay polygon B?
A
We must check each line in one data layer against every other
line in the second data layer to see if they intersect
(x2,y2)
Remember each line is composed
of a linked set of straight line
segments defined by a vertex
or a node at each end
We can use the equation for a
line, plus the coordinates at the
endpoints to define the line, and
use algebra and logic to see if
(x1,y1) the lines intersect
Equation of a line: y = m * X + b
2) Find intersection point
Y =1.375 * x -1.75 y = -1 * x +11
Set y values equal
y =1.375 * x -1.75 = -1 * x +11
(1.375 + 1) * x = 11 + 1.75
x = 12.75/2.375
= 5.37
y = 1.375 * 5.37 –1.75 = 5.63
Potential Intersection Point at x = 5.37, y = 5.63
Yes
No
No
No
Answer: No, the lines do not intersect
Finding the interior: Is a point inside a polygon (shaded)?
Potential point
Algorithm:
Pick a direction
(East (right) in the example)
Count line crossings to the
outside of convex hull (shaded
polygon)
If odd number then the point is
inside
If even, the point is outside
Spatial Analysis
Example
Minneapolis Ward Populations
Minneapolis population
What is the population of each ward in Minneapolis?
List
• the data you need
• the spatial functions you’ll use
• tabular operations you’ll apply
Ward boundaries
Census Blocks, Block Groups, Tracts, County
Zip Codes, States
Overlay operation
Summation, population density calculation (normalization)
Tracts are polygons, contain population
as an attribute recording the number of
individuals in the polygon. Tracts don’t
cross city (or other municipal)
boundaries
tracts
wards
Tract attributes Ward attributes
Wards with
census tracts
underneath Census tracts:
tabular data
includes area,
and number of
people in the
tract
Sketch out the steps (draw a flowchart) in your
analysis to calculate the number of people per ward
Data = 1) Ward Boundaries; 2) census tract boundaries with population counts
e.g.,
Tracts
that
Tracts Subset
overlap
wards
etc.,
Initial step - extract only the Census tracts that overlap with city Wards
Tracts
Subset via
that
Tracts spatial
overlap
selection
wards
or
Initial step - Clip/Intersect/Union the Census tracts that overlap with city Wards
Clip/Int/Un Tracts
Tracts Tracts with within
Wards wards
Spatial selection: variations on subsetting the tract data
Even a partial overlap selects the polygon (with this selection variant)
Other variants of spatial selection
Some variants give unexpected results
Overlay/intersect the ward polygons with tract polygons
Identify split tract pieces (new smaller
polygons from the intersection) that are in
each ward
Sum across the tract polygon IDs
Overlay:
Clip,
Intersect,
or Union
Intersect output
Intersect
Extract only the census tracts that overlap with city wards
Then Clip/Intersect/Union the census tracts that overlap with city wards
Tracts
Subset via
that
Tracts spatial
overlap
selection
wards
Clip/Int/Un
Tracts with Tracts
Wards within
wards
Intersect output
What is the next step?
Sum within wards to count population?
What is the next step?
Sum within wards to count population?
What is the next step?
Sum within wards to count
population?
What went wrong?
Does it matter if the ward and
tract lines aren’t co-occurring
(one on top of the other)?
Yes, yes it does matter. Partial overlaps carry the attributes of the
entire polygon, and most of these are outside the wards!
After the intersection,
the resulting polygons
contain all the attributes
and values for the input
polygons,
including the
population
value for the
ENTIRE input
polygon
What to do?
Calculate a density variable. Add column(s) in the original data,
and calculate number of people per unit area (e.g., people per
square mile).
BE CAREFUL of precision specified for the variable (e.g., 0.002
persons per square mile over 1,000,000 square miles is 2000
people).
If you store density in a variable that only carries two decimal
places, then the density rounds to 0.00. When you multiply by
area you get 1,000,000 * 0.00, which equals 0 people.
Original,
whole-
polygon
population
of 2194
More
reasonable
population
estimate of
26
Sum by Wards
Ask follow-up questions
• How can we improve the process?
• What is our main assumption during intersection?
• How do we minimize the likely violation of this
assumption?
Use smallest sampling
units possible..
Here, we use blocks
because individuals
not tracked in publicly
available census data.
Tracts (blue), Wards (green) Blocks (blue), Wards (green)
Originals
These slides are the originals of slides used in
the main sequence. The main-sequence slides
are images while these are
Measuring distance
5
• Euclidean
4
• Manhattan 3
2
1
10 9 8 7 6 5
9 8 7 6 5 4
8 7 6 5 4 3
10 9 8 7 6 5
7 6 5 4 3 2
9 8 7 6 5 4
6 5 0 3 2 1
8 7 6 5 4 3
5 4 3 2 1 0
7 6 5 4 3 2
6 5 0 3 2 1
5 4 3 2 1 0
Euclidean: as the crow flies
4 3 2 1
Real number = 2.5
5
4
3
2
1
Manhattan: along grid network without backtracking
10 9 8 7 6 5
9 8 7 6 5 4
8 7 6 5 4 3
7 6 5 4 3 2
6 5 0 3 2 1
5 4 3 2 1 0
Manhattan vector distance
10 9 8 7 6 5
9 8 7 6 5 4
8 7 6 5 4 3
7 6 5 4 3 2
6 5 0 3 2 1
Manhattan raster distance
5 4 3 2 1 0
Buffer operations
• Buffers = polygons whose boundaries are defined by
distance to input layer features
• Applications
• Zoning (e.g., setbacks)
• Planning (e.g., noise control, run-off)
• Service levels (e.g., nearest fire station)
Setback
Buffer
Overlay
pp. 394-409
Vector topological overlay
Two polygons with attributes A & 1
1
Overlaying polygons creates an
inherent universe polygon [ 0 ] A 0
2
A 0
1
?
184
0 1 Arc R Poly L Poly
1 A 0
Note: The arcs ‘keep track’ of the two
separate polygons that exist before the
2 0 1
overlay operation is applied
A 0 1. Find intersections
2. Create topology
3. ID Arcs & Polygons
1 4. Link to attributes
Arc R Poly L Poly
1
00 1 A0 00
A0
5 2 A1 01
3 A0 00
A1 4 4 00 01
3
5 A0 A1
2 01
6 6 00 01
00
Overlay operations
• Dissolve/Merge
• Union
• Intersect
• Identity
• Erase
• Clip
Overlay: Dissolve
• For features sharing attributes in both 1st and 2nd
layer, removes arcs between polygons and nodes
between arcs
A
A
A
Overlay: Identity
• 2nd layer loses features not bounded by 1st layer
A A0
A1
1
Overlay: Erase
• 1st layer is ‘erased’ or ‘masked’ by 2nd layer
A A
1
Overlay: Clip
• 2nd layer is a ‘cookie cutter’ for 1st layer
A
A
1
Overlay: Intersect
• In a pure intersection, features from both layers
remain
A
A1
1
Overlay: Union
• Input features from both 1st and 2nd layers remain
• Attribute values assigned by logical union
A A0
A1
1 10
Vector overlay challenges
• Donuts and islands ?
• Boundaries
• Errors is polygon boundary location
• Fuzzy boundaries
• Common boundaries
• Slivers!
Fixing slivers
Are these real polygons or slivers?
Fixing slivers during build
• Replace common boundaries
• On-the-fly snapping
What now?
Network Analysis
pp. 410-417
Network elements
Node Where links join
Links
Conduits for
movement
Cost of movement
over link
Impedance
Allowable movement
through node
Turn
Barrier
Node that
prevents flow
Source/sink where
resources enter/exit
Stop
Stop
Center
Nodes that receive or
provide resources
Stops in a stream
network where
water enters
6
14
12
12
20
22
29
24
31
37
43
35
38
42
Allocation
Center
Center
Center