As eye-catching as an isolated graphic or even a live map on a web page can be, real value comes from integrating specific business data with the capabilities of an API.
For example, you can use the Google Maps API — even when no maps are in sight — to perform interesting functions. In setting up a teleconference or an online help session for a client, for instance, it can be crucial to confirm which time zones are in play for participants. You can use an API to do this.
It can be distracting, time-consuming and error-prone to ask users for their time zone; an API can simply answer the question. A number of things streamline the process:
- If an end-user’s clock is correctly configured, the browser Date object supports a getTimezoneOffset() method that reports the difference between the end-user’s time zone and UTC (the Coordinated Universal Time reference).
- HTML5 geolocation methods give a user’s physical location, subject to privacy constraints.
- Several services support real-time lookup of geographic location based on IP address.
Given geographic details like these, one capability of the Google Maps API is to look up time zone. This example illustrates its use: