HTML and CSS Reference
Finally, we check the value of the units drop-down to find out if the user wanted the
total distance in miles or kilometers. Then we call one of our helper functions meter
sToKilometers() or metersToMiles() to convert meters into kilometers or miles,
respectively, and output the value to the distance div element.
For more about getting directions from the Google Maps API, see http://code.google
8.6 Example: Starbucks to Starbucks
You want to get directions from the nearest Starbucks to the next closest Starbucks.
Use SimpleGeo's Places API to find the closest Starbucks to the user's current location
and then, once that location is set, make a second API call to SimpleGeo to find the
next closest Starbucks location. Then use the Google Maps API to give directions from
the first Starbucks to the second Starbucks.
SimpleGeo is free, but it does require you to sign up to get an API key (see http://
simplegeo.com ). Once you've signed up, you can find the API key by clicking the Tokens
menu and then the JSONP Tokens submenu, as shown in Figure 8-5 .