Using Geolocation APIs

Screenshot of Google's Maps Geolocation API Website
Google's Maps Geolocation API

One of the major advancements in user experience on the Web is the customization of content. By using geolocation APIs, sites can now offer up deals or information based on the user's location. This can lead to increase sales for businesses or a better user experience for sites that provide venue-type content.

Popular Geolocation APIs

Programmers have plenty of choices when it comes to geolocation APIs. Five well-known providers that offer free versions of their API include:

1. Google

Google's Maps Geolocation API is possibly the most commonly known geolocation API. The program works by using the media access control (MAC) address of the WiFi node and the signals strength while also requesting cell tower ID numbers or the location area code (LAC).

When the device is successfully located, the API returns a longitude and latitude coordinates as well as a radius of accuracy.


  • Designed by Google so it integrates well with Google Maps
  • Does not rely on GPS to locate a device (reducing battery drain)
  • Unlike GPS, Google's API works reasonably well in dense city blocks


  • If you are a large business, you will most likely need to purchase the business API due to daily limits of free version

2. Yahoo

Yahoo offers two geolocation services: Yahoo BOSS PlaceFinder and PlaceSpotter. PlaceFinder is a geocoder API while the PlaceSpotter API tries to determine "the 'whereness' of a document."


This PlaceFinder API determines an address based on longitude and latitude coordinates, or it can do the reverse and determine the coordinates based on street address. The service powers Foursquare, a social media site that relies heavily on location-based services.


  • High number of requests permitted on a daily basis (currently 50,000)
  • Capacity to reverse-geolocate is built into API
  • If desired, it can return a location's Where On Earth Identification number (WOEID).



Although technically not a geolocator, it is included here because of its ability to derive a location based on a web document presented to a user. The API searches for keywords - such as addresses or names of cities - and then makes a calculated guess about the physical location and suggests, for example, another similar business located nearby.


  • If your content lends itself to 'neighborhood' venues, then PlaceSpotter could help users find nearby venues of similar interest


  • It's a bit of a guessing game, so accuracy is dependent on careful creation of your content and keywords.

3. Bing Maps

This Microsoft product is known for its speed and - in at least one head-to-head comparison of Bing Maps and Google Maps - its superior clarity of satellite imagery. Some users report that Bing Maps is more accurate with driving directions than Google. The service requires an API key and there is a batch API allowing multiple addresses to be converted at one time.


  • Fast and accurate
  • Clear satellite images
  • A bird's eye view feature which gives aerial views from multiple angles.


  • The monthly usage limit is somewhat unclear, although it appears to be 10,000

4. MapQuest

This API has been around for a while and is a front runner in the transition to open maps. The company lets you choose between using licensed maps or open maps. The free open map option has no usage limits, but it does not provide routing or traffic services. To get that feature you need to use the paid licensed map option. One key feature to the open map option is that, unlike most non-open-source APIs, it can be used for paid applications.


  • Driving direction capability is built in
  • No preset usage limit on maps with free Community Edition license
  • Relatively inexpensive paid option



The HTML5 geolocation API works in most of the major browsers and works by adding a small amount of coding to the HTML on your website. The coding calls out to one or more functions of the geolocation object -- an attribute of the Navigator object. Since it is browser-dependent, the API approximates your location based on the browser-specific method of geolocating, including one or more of the following:

  • Your public IP address
  • Cell tower IDs
  • GPS information
  • WiFi access points and signal strengths
  • MAC IDs

One issue to remember when using this API, is even though it works with most browser, you need coding to fall back on for older browsers or systems that don't permit positioning devices. In these cases, the fallback method could allow users to enter or change their locations manually.


  • Simple to implement on a website
  • Returns either a street address or the longitude and latitude coordinates
  • Increased accuracy on mobile devices since GPS can also be utilized


  • Is browser-based, making it dependent on the settings supplied by the user

Privacy Concerns

Because of the potential invasion of privacy, the W3 standard for geolocation programming is to always ask the user's permission before tracking their location. However, each browser and system handles this differently so make sure you double check your settings if you do not want your position tracked.

Was this page useful?
Related & Popular
Using Geolocation APIs