25.02.2013 Views

Peter Lubbers - Pro HTML 5 Programming

Pro HTML 5 Programming

Pro HTML 5 Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Show Me on a Google Map<br />

CHAPTER 4 ■ USING THE <strong>HTML</strong>5 GEOLOCATION API<br />

One very common request for geolocation data is to show a user’s position on a map, such as the<br />

popular Google Maps service. In fact, this is so popular that Google itself built support for <strong>HTML</strong>5<br />

Geolocation into its user interface. Simply press the Show My Location button (see Figure 4-5); Google<br />

Maps will use the Geolocation API (if it is available) to determine and display your location on the map.<br />

Figure 4-5. Google Map’s Show My Location button<br />

However, it is also possible to do this yourself. Although the Google Map API is beyond the scope of<br />

this book, it has (not coincidentally) been designed to take decimal latitude and longitude locations.<br />

Therefore, you can easily pass the results of your position lookup to the Google Map API, as shown in<br />

Listing 4-18. You can read more on this subject in Beginning Google Maps Applications, Second Edition<br />

(Apress, 2010).<br />

113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!