Chapter 14. Geolocation and Maps

One of the great features of mobile devices is that they can go everywhere with us. That is why the where is a very important context to be considered by our websites. Knowing the user’s location can help us to show useful contextual information. If I live in London, why should I receive a banner promotion from a shop in New York? Likewise, if I am on holiday in Singapore and I search for “pizza,” I would like to receive relevant information about where I can get it.

Location-based services (LBS) are one of the key features of modern mobile web applications. From our mobile websites, we can get the user’s location using many techniques. Mapping and LBS are very popular right now, so it is easy to find web services and APIs from different providers that we can integrate into our mobile websites.

Location Techniques

There are different techniques that we can use to determine the geographical location of a device, based on the platform, the browser, the operator, and so on. Most technologies involve server detection, but others depend on client detection, and we may even rely on the user’s input.

Accuracy

Every location technology has some accuracy error. This is usually specified in a distance metric, like meters or kilometers, but in some techniques accuracy is defined according to levels, such as city accuracy or country accuracy.

Indoor Location

When we think about geolocation, we tend to think about the outside location—that is, where on the planet the ...

Get Programming the Mobile Web, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.