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
  • PrintPrint
Share this Page URL
Help

7. Geolocation Hacks > Hack 60. Update a User’s Current Location in a Google Ma...

Hack 60. Update a User’s Current Location in a Google Map

Sometimes the user of your application is moving and a location needs to be updated at a regular interval. You can use a Google map to display a moving pin of the user’s locations.

Using the Google Maps API

In this hack we will start by including the necessary dependencies for displaying Google maps within our application. Fortunately, the Google Maps API makes this very simple. Just be sure to include the dependency in the head of your application’s document.

<script type="text/javascript" src="http://maps.google.com/maps/api
/js?libraries=geometry,places&amp;sensor=false"></script>

We also need an empty div element to populate with our map:


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint