I am currently building a new web product that relies on client location to a large extent. During the development I had to learn about the geo-location API for use within HTML5 compatible browsers, and thought I’d share how simple it is to use. Article first published on gooroo.io.
The use of GPS data has become second nature for most everyday tasks. The most common scenario of finding your way from A to B using GPS is obvious, but there are a lot of other uses as well. When you ask to find the nearest store on a company website, GPS is used. When you log into Facebook in a foreign country and you subsequently get ads for all of the Swedish natural foods you can eat, GPS is used. When you ask Google to remember where you parked your car, GPS is used. And many more ways.
Using GPS in your web app is not difficult, but there are a few points to note and some pit falls to avoid. This article will show you how to use the GPS hardware on the user’s device, and then take that one step further to use Google’s Map API to reverse geo-code the result and make it some kind of useful.