HTML and CSS Reference
In-Depth Information
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.
See Also
For more about getting directions from the Google Maps API, see
.com/apis/maps/documentation/javascript/services.html#Directions .
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.
To begin, add the SimpleGeo API to the collection of JavaScript libraries:
<script src=""></script>
<script src=""></script>
<script src="">
<script src="">
SimpleGeo is free, but it does require you to sign up to get an API key (see http:// ). 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 .
Search WWH ::

Custom Search