Geolocation is more important now than ever before. It is a great way to add an ‘app-like’ feature to your progressive web application. We like to know what business, attractions and destinations are around, where we are, and how to get where we are going.

A common use of geolocation is to show where stores are located and possible driving directions.

Now that Smartphones are ubiquitous, we want information right now, wherever we are. Popular applications like Google Maps, Yelp and Facebook let us locate businesses and friends near our locations right from our phone.

I have been fascinated with geolocation-based data for several years now and have watched the technology evolve. In the past the best you could do to determine a user’s location was to map it through a geocoordinated IP database.

To access a geocoordinated database, you either needed to subscribe to a service which would translate an IP address to an approximate latitude and longitude, or you needed to maintain a local database with this information.

Either option was not cheap or completely reliable. In my experience, an IP address does not actually correlate to a device’s location all the time.

For example, I used to have a Sprint 3G service for my laptop. The account that activated my service was located in the Chicago, IL area. Whenever I visited sites using geolocated content, I would receive content related to the Chicago metro area.

The funny thing is the only time I was in the Chicago metro area was changing planes at the airport! We have had a better way to target a user’s location thanks to the http://www.w3.org/TR/geolocation-API/” target=”_blank” rel=”noopener”>HTML GeoLocation API.

The HTML Geo-Location API

All browsers support and have supported native support for the geolocation API for about a decade. So, the API is safe to use.

Using the geolocation API combined with a map service like Microsoft Bing Maps or Google Maps target=”_blank” rel=”noopener”>Google Maps Platform provides a rich end user experience. You can add a map service to your site to add more value and app like experiences to extend your brand.

Now you can pinpoint where the visitor is located and add nearby locations to a map, provide driving directions and more. You should be aware these services do charge for some features. You will need to consult their service pages to understand their pricing model so you won’t be surprised.

#api #geolocation api #web app

Using the Geolocation API in your Progressive Web App
1.40 GEEK