O'Reilly logo

Programming the Mobile Web by Maximiliano Firtman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Showing a Map

Once we have located the user (via a client or server solution), we may want to display a map showing the user’s position, and/or a list of points of interest or other information superposed on the map.

To do this, we should use one of the available public maps APIs: Google Maps, Bing Maps from Microsoft, Yahoo! Maps, or OVI Maps from Nokia. However, if we analyze mobile compatibility, there is really only one choice: Google Maps. Compatibility for the others may increase in the future, but at present Google’s API is by far the best supported.

There are actually two Google APIs that are useful for mobile browsers: the Google Maps API v3 and the Google Maps Static API. The first one is the same service that we can find in any website using Google Maps. However, it is currently compatible only with iPhone and Android devices; on other devices, this API will not work properly. The Static API will allow us to show a static map compatible with any mobile browser.

Note

Yahoo! APIs will be compatible if we use the Point of Interest (POI) search or even the geocoding services. Microsoft also offers Bing Maps Web Services with similar solutions.

Google Maps API v3

If we are sure that the device is an iPhone or Android device, we should use the Google Maps API version 3, as shown in Figure 11-5.

Here we can see the Google Maps API on an iPhone showing the user’s current location using the multiplatform framework.

Figure 11-5. Here we can see the Google Maps API on an iPhone showing the user’s current ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required