A Study Using The HTML5 Geolocation API
The rise of mobile devices in recent years has changed the game to add location awareness to many applications, even line of business apps. A few years ago I ran several sites that allowed visitors to find resources in their area. Most notably I ran a site to locate area golf courses. I used the golf course site's core in many of my presentations at the time.
Back then the way I would determine a user's location was to query an IP database that would have a reasonable latitude and longitude available to query my database and center a map from either Google or Bing. Today that has changed as all the current browsers support the HTML5 Geo-location specification. In essence you should no longer need to query an IP database, instead the browser makes the users latitude and longitude available with an associated accuracy.
While the HTML5 Geo-location support may not provide a faster experience for your application compared to a private database lookup, but what it does provide is a multi-tiered approach to identifying where the user is actually located. On my sites I would include a query to my privately hosted database, on my server, today browsers leverage a system that queries a combination of location services, starting with GPS service if it is available on your hardware.
Most mobile devices have a GPS chip, which provides the most accurate reading. However this will only work if the device is outside. Typically I am able to get accuracy within 10 meters, once I move inside this accuracy degrades. The reason accuracy degrades is access to the GPS satellites is blocked by the building or structure surrounding the device. At this point some fall backs kick in.
I there are Wi-Fi access points available, think about a Wi-Fi router in your home and your neighbor's homes. These access points have their locations stored in publicly accessible database maintained by Google, Microsoft, Apple and I assume a few others. If you are surprised by this you should not be. When Google creates a street view they drive around streets and log all the SSIDs they encounter and where they are located. From this information they have created a very rich database of publicly visible access points. I am not sure where Microsoft, Apple and others have procured the information in their databases. Another popular service some location aware applications use is SkyHook.
If your device can't determine your location from GPS or Wi-Fi and it will try to triangulate off cell towers. This is typically the least accurate way to determine location. In my experiments when using cell tower triangulation the accuracy value was typically 3000 meters, inside buildings. My current provider is Sprint, a CDMA network. I have read other providers report in the 1000 meter range. When outside, and GPS not available the accuracy could range between 60 and 360 meters. Either way this is not the most accurate means to determine location, but for most location aware applications this is accurate enough. Another note about using cell towers is the phone may only report the distance from the tower currently in use, further reducing accuracy. I suspect this might be the reason my phone reported a 3 km variance.
Additional Location Data
Latitude, longitude and accuracy are the only required values returned in the coordinate object. Additionally it may also report the device's altitude, altitude accuracy, heading and speed. Often these value are not provided, at least for me. My phone is an HTC Arrive on the Sprint CDMA network. My other test devices are relegated to Wi-Fi only, so they do not reflect a real scenario, except for Wi-Fi.
For my desktop browsers the altitude information never seems available. It could be because this is not available for the access points in my range. The heading and speed are never provided, but I think this is to be expected because a desktop or even a laptop is not really a device that affords a moving target very often. As for my mobile devices, Windows Phone, iPhone and Android phones this varies. I am finding my iPhone does report altitude. I am not sure if this is due to the ATT inactive SIM card I have in the phone or is part of the normal iPhone Geo-location service. My Wi-Fi only iPad does report altitude information. Safari on my desktop does not report the altitude. My Windows Phone did report altitude as long as I had a GPS or decent cell tower reception.
In my recent experimenting I failed to get heading and speed values. However I did do some preliminary testing last summer and did get these values, again on my HTC Arrive, intermittently. I did those tests, as I did yesterday, at a local mall with 3 levels. I recall walking on the first floor last year and receiving the speed and heading values at times. But I also was able to get much more accurate location values on the same first floor. Yesterday however I was only getting a poor accuracy location value (3 km) on the same floor. In fact the only time I was within a football field's accuracy was on the 3rd level, when I was on the main concourse, close to the aluminum ceiling with a running sky light. My suspicions are the Sprint network quality has degraded a lot since last summer as I am finding it harder and harder to maintain a solid signal each day in many markets.
Increasing mobile smartphone and tablet adoption each day is increasing the need to create location aware applications for both consumer and line of business applications. In the consumer market local, meaning what is really close to me right now, searches are becoming more and more important because mobile users want to find things like stores, places to eat and directions immediately. Adding Geo-location capabilities to an application increases its value to mobile users. As businesses are struggling to adopt a quality mobile strategy including location awareness to line of business applications adds value to many existing line of business applications. Employees can locate resources, fellow employees faster. Location data can also be attached to added as meta data to transactions and other logging activities providing a much richer index.
The HTML5 Geolocation API makes including valuable location data easy. Understanding the quality of the location information also increases the knowledge of business processes and consumer retail opportunities.