Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 7: GPS and Google Maps > Using Google Maps

Using Google Maps

The Google Maps API gives you the ability to interact with road and satellite maps accessible via Google and use Google Maps on your mobile site; all you need are a few lines of code.

A Simple Map Example

In this simple example, we reference the Google Maps JavaScript file from Google and then create an initialize() function. This function name is just arbitrary; it can be anything you want. It either can be initialized via body.onload or via jQuery in $().ready or can be initialized manually via some button click or other kind of event.

The first thing you do is create a LatLng object with a latitude and longitude in the constructor followed by some options, specifically:

  • zoom: This is the zoom scale of the map you are displaying.

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial