geolocation


Knowing the location of your users can help boost the quality of your Web site and the speed of your service. In the past, users had to actively input their location and submit it to a site, either by typing it, using a long drop-down list, or clicking a map. Now, with the HTML5 Geolocation API, finding your users (with their permission) is easier than ever. Figure 1 shows a Web site using geolocation to determine the location of a user, represented in latitude and longitude. The numbers can easily be translated into something more understandable, such as the street name or city.




Imagine how useful your site could be if it provided online timetables for all public transportation in a particular city. Using geolocation, the site could recommend optimal travel routes to get people where they’re going as quickly as possible. Desktop users could get their start location sorted by proximity to their computer. Mobile users trying to get home after a night out could quickly find the closest bus stop within walking distance. These possibilities and more are just an API away.

Scenarios for Using the Geolocation API

Here are 12 simple scenarios that illustrate how a Web site can accommodate users and customize their experience by taking their location into account. Some of them might seem obvious, but the small things often make the biggest differences.
  • Public transportation sites can list nearby bus stops and metro locations.
  • Late night out? Taxi or car service Web sites can find where you are, even if you don’t know.
  • Shopping sites can immediately provide estimates for shipping costs.
  • Travel agencies can provide better vacation tips for current location and season.
  • Content sites can more accurately determine the language and dialect of search queries.
  • Real estate sites can present average house prices in a particular area, a handy tool when you’re driving around to check out a neighborhood or visit open houses.
  • Movie theater sites can promote films playing nearby.
  • Online games can blend reality into the game play by giving users missions to accomplish in the real world.
  • News sites can include customized local headlines and weather on their front page.
  • Online stores can inform whether products are in stock at local retailers.
  • Sports and entertainment ticket sales sites can promote upcoming games and shows nearby.
  • Job postings can automatically include potential commute times.

How Geolocation Works

Technically speaking, a PC or a mobile device has several ways to find out its own location (hopefully, in the same place as the user).
  • GPS is the most accurate way to determine positioning, but it’s less energy efficient than other options and sometimes requires a lengthy startup time.
  • A-GPS (assistive GPS) uses triangulation between mobile phone towers and public masts to determine location. Although not as precise as GPS, A-GPS is sufficient for many scenarios.
  • Mobile devices that support Wi-Fi access points can use hotspots to determine the user’s location.
  • Stationary computers without wireless devices can obtain rough location information using known IP address ranges.
When it comes to sharing the physical location of users, privacy is a serious concern. According to the Geolocation API, "user agents must not send location information to Web sites without the express permission of the user." In other words, a user must always opt in to share location information with a Web site. Figure 2 shows a typical message requesting a user’s permission. For more information about ensuring security with the Geolocation API, see

TRANSLATE this Page

Posting Komentar

0 Komentar