Compare road distance with straight-line distance to create an index of nausea.
As I'm blessed with a sweet but stomach-challenged boy, I'm often looking for routes that are less likely to trigger his "I need to throw up; where's your hat, Daddy?" reflex. The quickest way to trigger that impulse is to go too fast on a curvy road.
I originally developed my own little index of road curviness that I called the "quasi-fractal dimension" of a route. As it turns out, the professionals already have their own measure for this property, and our technical reviewer Edward Mac Gillavry set me straight.
In spatial analysis, the network deviousness is the discrepancy between the lengths of the actual routes in a network and the straight-line distance between the places linked up. For any pair of places on the network it can be measured by the detour index. The detour index is a measure of how directly movement may be made on a network. It is calculated as the ratio of the shortest actual route distance between a given pair of nodes and the direct, straight-line or geodesic distance between the same two points.
Detour index = shortest distance on a network between two points / direct distance * 100.
The minimum value of the index is 100, representing a direct route with no detour. High ratios suggest a weakly connected network but may also reflect the indirectness or deviousness of the individual routes connecting the nodes. The detour index is also referred to as the index of circuity or as the route factor.
So if the straight-line distance between two points is 20 miles, but the road distance is 25 miles, we get a detour index of 25/20 * 100 = 125. The road isn't curvy, honey; it's just devious.
1.8.1. Getting the Data
If you know the street address of your starting and ending points, you can use Geocoder.us to get the latitude and longitude, as explained in [Hack #79] Otherwise, try the "How Far Is It" service at http://www.indo.com/distance. You can enter two cities, and "How Far Is It" will return the great-circle distance, as shown in Figure 1-15 (the great-circle distance is the spherical trigonometry version of straight-line distance).
Figure 1-15. How far is it?
If you know the latitude and longitude for each end of your trip, this can be plugged into the "How Far Is It" site. [Hack #11] shows you how to calculate straight-line, "as the crow flies" distance with a "geoenabled" Excel spreadsheet.
Once we have a good direct distance, we can use the techniques described in [Hack #5] to get the estimated time for each segment of the journey, and the "what if the crow has to ride in the back of the van with a hat in his lap" distance. Putting it all together, we get the summary table shown in Figure 1-16.
Figure 1-16. Quantifying physical discomfort
Figure 1-16 shows some trips that are common in my life. The direct distance is the straight-line distance between the two points. Mapquest Distance is the distance reported by MapQuest. Detour Index is calculated as shown earlier. The table also shows the estimated time and the average speed for this trip.
Here we can compare the straight-line distance with the routed distance. Highway 17 over the Santa Cruz Mountains is notoriously curvy. The other numbers yield few surprises. Sacramento to Bakersfield was a ringer! That trip is almost straight down Interstate 5. It has the lowest Detour Index of any of the sample routes.
An awful example of curvy driving is the route from Willits, on highway 101, to Fort Bragg. That section has a 147% distance premium, compared with the straight-line distance.
Assuming these relationships hold true, I can assert that a Detour Index greater than 120 is almost guaranteed to make you sick! I wish to avoid the curvy routes, but some folks like curves, so another use of this technique is to find the curviest possible roads for motorcycle fun. Just remember: for some people, motion sickness is no laughing matter. For the rest of us, it is.
1.8.2. More Information
"How Far Is It" is the creation of Darrell Kindred. It uses the geod program from the PROJ system discussed in much more detail in [Hack #27] . Darrell also has a Perl program to calculate great-circle distances on the earth. His use of geod and his sample code are available at http://www.indo.com/distance/distance-details.html. Another useful page is his discussion of using xearth to create views of the earth, at http://www.indo.com/distance/earth-image-info.html.
Mapping Your Life
Mapping Your Neighborhood
Mapping Your World
Mapping (on) the Web
Mapping with Gadgets
Mapping on Your Desktop
Names and Places
Building the Geospatial Web
Mapping with Other People