HTML and CSS Reference
In-Depth Information
chapter 12
n n n
Finding Location with the
Geolocation API
Most of today's web applications don't care where you're accessing them from. Regardless of your
geographical location, they present the same content in the browser. However, if you make such
information available to web applications, they can make innovative use of it. For example, a social
networking web application can suggest friends who are in the same locality as you. User-location
information can also be used in job portals to suggest jobs near the user's geographical location.
The idea of tracking user location isn't new, but at first there was no standard way to find this
information. Luckily, over the years a standardized approach—geolocation—has evolved to address this
need. The Geolocation API allows you to find a user's location by using various location sources such as IP
address, Global Positioning System (GPS), Global System for Mobile Communications (GSM), and general
packet radio service (GPRS). Strictly speaking, the Geolocation API isn't part of HTML5. However, most
often it's used and grouped with HTML5 features and technologies. This chapter gives you a detailed
introduction to the Geolocation API. Specifically, you learn the following:
• What is geolocation?
• Finding and tracking user location using the Geolocation API
• Integrating the Geolocation API with Google Maps and Bing Maps
• Using the Geolocation API to present location-speciic data to the user
Overview of the Latitude and Longitude Coordinate System
To convey a user's geographical location, you need a standard system that can be understood by all the
parties involved in the process. In day-to-day life, location information is expressed in terms of city, state,
country, and so on. However, such information is of little use for calculation purposes. For example,
looking at two city names, you can't tell the distance between them. That is why location is specified using
a geographic coordinate system. The system used by the Geolocation API consists of latitude and
longitude coordinates.
A latitude coordinate specifies the north-south position of a point on the Earth's surface. Points with
the same latitude run east-west as circles parallel to the equator. Latitude is an angle ranging from 0° at the
equator to 90° (north or south) at the poles.
 
Search WWH ::




Custom Search