Today at the last day of the "Voices that Matter" GWT conference, Dan Morril (of Valleywag-Muppet fame) and I presented a session on using the Maps + Gears API wrappers in GWT. (And yeah, I overslept, couldn't make a Caltrain time, and paid $100 for a taxi ride up to SF. One day I'll learn. Maybe.)
So Dan and I presented a pretty fun/useful combination of the two APIs: Offline Driving Directions. First I presented the non-Gears-ified Driving Directions example, which basically tries to mimic the Google Maps "to" and "from" box, complete with auto-suggest based on entered queries (using the nifty built-in MultiwordSuggestOracle), and of course, the directions steps and map overlays. Screenshot below:
Then, Dan showed how to make the app more functional by adding Gears, in two ways:
- Use the local Db to store entered queries, so the app remembers all queries we ever enter on that computer, regardless of browser shutdown. That data persistence makes our auto-suggest alot more useful.
- Use the local DB to store directions results (the text), and use the local server to capture the files used by the application.
Want to try it out yourself? First you need to download the google apis wrapper library (beta) here. Then download the zip file of the driving directions sample here. The gears version isn't up there yet, should be soon.
Note that you can't actually take the Maps API tiles and functionality offline with Gears, for a couple reasons. The local server can only store files that are on the same-domain as the app. That means it cannot be used to capture Maps API tiles or the Maps API script. It is technically feasible to download the script to your server and setup a proxy for the API tiles, but that would be against the (in)famous Maps API Terms of Use.
No comments:
Post a Comment