Hack 41. Use Google Maps


Although Google provides access to maps for handhelds through Google Local, this handy program works very similarly to the full browser implementation of Google Maps.

It's hard to overestimate the impact on the online map industry that Google Maps (http://maps.google.com) has had. The crisp, readable maps, along with the integration with Google Local, have made quite a splash in the online community. But most agree that the most innovative feature of the Google Maps interface is its clever use of JavaScript to create a user experience in a simple web browser, rivaling the most polished of desktop software without requiring browser plug-ins.

4.6.1. Use Mobile GMaps

You can use a program called Mobile GMaps (http://www.mgmaps.com/) to access Google Maps from your BlackBerry. It is available for free and you can download it over the air right from your device by going to their WAP interface (http://wap.mgmaps.com/).

Once installed, use the MGMaps icon on the Home screen to open the program. You're greeted with a map of the United States (see Figure 4-12), the same default view you'll find on Google Maps (http://maps.google.com).

Figure 4-12. The default view in Mobile GMaps


Use the trackwheel to access the menu and select Search to enter an address to search for. You can perform searches, such as restaurants in New York, NY, or you can search for a specific address in the Where field. You can also choose whether to view a regular street map or a satellite view. Once your search results are returned, use the trackwheel to highlight one of the results and choose Select from the trackwheel menu. This will download the appropriate images from Google Maps to your BlackBerry and display them as shown in Figure 4-13.

4.6.2. Use GMapViewer

Google Maps's sophisticated use of JavaScript (a technique known as AJAX) is not yet available in any handheld browser, but there is a free program for handhelds called GMapViewer (http://www.sreid.org/GMapViewer/) that creates a look and feel that is similar to what the Google Maps interface provides to desktop browsers. Because it is written according to the J2ME specifications, you can run it on your BlackBerry!

Figure 4-13. W Main Street in Carrboro, NC


Go to the GMapViewer web site (http://www.sreid.org/GMapViewer/) and use the over-the-air download to install the application. After you install the program, click on its icon on the Home screen to execute it. Figure 4-14 shows the very simple screen that appears when you bring up GMapViewer.

Figure 4-14. GMapViewer Home screen


4.6.3. View a Map

To view a map, click the trackwheel from the menu and select the Search menu option. This brings you to a screen to create searches for cities and addresses, as shown in Figure 4-15. Select New search from the menu and enter an address or city for a place for which you'd like to view a map. You'll need to enter the address all on the same line.

Figure 4-15. Choosing New search from the menu


Click the trackwheel and choose OK. The search you entered is sent to the service's web interface (more on this later) and is validated. Once the search returns, use the trackwheel to choose Select from the menu, and you will be taken to the map for that location in another screen.

4.6.4. Navigate the Map

You will notice a similar look and feel to the click and drag interface you're used to in your desktop browser. Use the trackwheel to scroll to the edges of the map, and the new sections will be filled in on the fly. Figure 4-16 shows the program as you scroll to the map's edge. Notice the orange and blue blocks that appear for areas on the map that have yet to be downloaded. Also, the wireless activity arrows indicate that the missing images are being retrieved onto your device.

Figure 4-16. Scrolling to the map's edge


4.6.5. Add a Map Pin

You can add new map pins, which will be stored in a menu for easy access. There is a crosshair in the middle of the map screen that stays centered as you scroll around the map. At any time if you would like to create a waypoint as a location bookmark, click on the trackwheel and choose New Map Pin from the menu. This brings up a text entry field in which to enter a string that identifies the location. After you've typed the text for your map pin, choose OK from the trackwheel menu. You'll be returned to the map you were viewing, and you'll see a red map pin with the text you entered on the map, as shown in Figure 4-17. The map pins you create are stored on your device. You can go to the Map pin menu to view all the pins you've created and go directly to that section on the map.

Figure 4-17. A custom map pin


4.6.6. How Does This Work?

GMapViewer is used in conjunction with a web service. This web service acts as a gateway and runs as a PHP application that can be downloaded along with the source code for the J2ME client software. By default, the client points to a copy of the web service running at the author's web site. Be sure and check the GMapViewer web site for updates the author currently states that the gateway could be taken down at any time.

If the gateway was put out of service, I would anticipate another kind soul to provide a different gateway that clients could point to. Because both the client and gateway components are released under the GPL (GNU Public License), you could download the source code and run a GMapViewer gateway on your own web server!



BlackBerry Hacks
Blackberry Hacks: Tips & Tools for Your Mobile Office
ISBN: 0596101155
EAN: 2147483647
Year: 2006
Pages: 164
Authors: Dave Mabe

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net