Geocoding and Routing

Geocoding and Routing
Ya can’t get
thereah from
hereah!
CS 128/ES 228 - Lecture 9b
1
The Traveling Salesman Problem (TSP)
Insert Joke Here

A Salesman must
visit each of N
cities and return to
his home base,
driving as few
miles as possible
CS 128/ES 228 - Lecture 9b
2
Difficulty of TSP

Of interest to theoretical computer
scientists
because
The Problem Is HARD

So hard that if you could compute an
exact solution efficiently, you could also
disrupt the world’s financial markets*
*more so and more profitably than has
been done by the financial industry thus
CS 128/ES 228 - Lecture 9b
far
3
Applications of TSP

Inspection
routes

Traveling
Salespersons

Delivery
professionals
CS 128/ES 228 - Lecture 9b
4
Knowing Where You Are
GEOCODING “is the process of
converting an address into a
point location.”
McDonnell and Kemp, International GIS Dictionary, 2nd Ed.,
1998
“Hey, hey, hey. Don't be mean. We don't have to be
mean because, remember, no matter where you go,
there you are.”
Buckaroo Banzai (from The Adventures of Buckaroo Banzai Across
the Eighth Dimension)
CS 128/ES 228 - Lecture 9b
5
TIGER Maps – The Key to Routing

TIGER maps
are the primary
data set used for
geocoding.

… and geocoding
is the basis for
all routing.
CS 128/ES 228 - Lecture 9b
6
TIGER Map of the Area
Dr.
Levine’s
House
CS 128/ES 228 - Lecture 9b
7
TIGER Attribute Data
CS 128/ES 228 - Lecture 9b
8
Some Useful Fields
FID
LENGTH
FNODE
TNODE
FENAME
FRADDR
TOADDL
ZIPR
Field ID Number
Length of full extent
Intersection of “start” of street
Intersection of “end” of street
Street name (root)
# of first house on RIGHT side
# of last house on LEFT side
Zip code of RIGHT side
CS 128/ES 228 - Lecture 9b
9
23
How to Find an Address
1. Find the records for the appropriate
street. (There may be more than
one.)
2. Find the particular record whose
address range includes your house
number.
3. Decide “left” or “right” based on
parity.
4. Interpolate.
CS 128/ES 228 - Lecture 9b
10
But Apply Georgian’s First Law
(of data processing)
Don’t process
the data
yourself; get
someone else
to do it
http://www.mapquest.com
CS 128/ES 228 - Lecture 9b
11
Limitations of Geocoding
Dr. Georgian says
he lives here
Mapquest says
Dr. Georgian
lives here
Whom do you believe?
CS 128/ES 228 - Lecture 9b
12
Why Is It Wrong?
Where is Dr.
Levine’s House?
(#3299)
FRADDR
3179
TOADDR
3297
FRADDL
0
TOADDL
0
CS 128/ES 228 - Lecture 9b
13
Common TIGER Errors
 TIGER Files commonly miscode the F…
and T… fields; this results in various
“mirroring” errors.
 TIGER Files often do not know the true
extremal values for a block
 Newer versions of the data make this
error less frequently.
 Both Dr. Georgian and Dr. Levine are
“victims” of this kind of error.
CS 128/ES 228 - Lecture 9b
14
Other TIGER Errors
Data Lag
causes errors as new
roads are (or are not)
built
This road does not
exist!
CS 128/ES 228 - Lecture 9b
15
How Do We “Really” Do It?
By following instructions in this
afternoon’s lab!
CS 128/ES 228 - Lecture 9b
16
Going “Big” Time
One can easily geocode many
addresses at once.
Place them all in a table and then
ask the system to do so.
This gives you all of your “hot”
locations.
CS 128/ES 228 - Lecture 9b
17
Now, How Do You Visit Them All?
CS 128/ES 228 - Lecture 9b
18
How many ways are there?
For 20 stops, there are
20x19x18x…x3x2x1 =
2,432,902,008,176,640,000
Possible routes! (that’s 2 quintillion)
Once again, we cannot be exact
Once again, we need a GIS
CS 128/ES 228 - Lecture 9b
19
A Simple (non-)Solution

Choose the route yourself

It turns out that humans,
particularly experienced humans,
are good at this

Then check only your 3 (or 40) best
guesses!
CS 128/ES 228 - Lecture 9b
20
Working with Simpler Routes
So it
can be
done
And we
can’t
do it
CS 128/ES 228 - Lecture 9b
21
A Poor Man’s Solution
1. Select the lines that comprise
your route.
2. Create a layer out of the
selection.
3. Create a query that sums the
lengths of the roads.
CS 128/ES 228 - Lecture 9b
22
?
Conclusions
• Finding, Creating, and Measuring routes is
a key task of many GIS’s.
• With ArcMap, we can do this for Points
(geocoding), but not for extended routes.
• There are some “workarounds” we can
use.
CS 128/ES 228 - Lecture 9b
23