0

Is there a (free) webservice where I can a) give it an address (either full or city, state/province and zip), and b) get the IANA timezone of that address?

Use case: I have a form where a user manages clinics. Each clinic has an address. I want to preselect that IANA timezone of that address, so that I can adjust appointment date/times associated with that clinic.

I know that the Google Maps API and Bing Maps API can give me the lat/long of an address, and that there are other services that can give me the IANA TZ based on the lat/long. That said, those api's require subscriptions and keys and contracts, and it would also require a two request approach to get the single piece of data.

Steve -Cutter- Blades
  • 5,057
  • 2
  • 26
  • 40
  • Is it worldwide, or just the US? (You mention zip code) – Matt Johnson-Pint Mar 10 '21 at 20:42
  • Also, for part two of the steps you mentioned, there are offline solutions. See https://stackoverflow.com/a/16086964/634824. – Matt Johnson-Pint Mar 10 '21 at 20:43
  • @MattJohnson-Pint Starts in the US and it's territories, but eventually global. Yeah, even after looking at items in that list, everything appears to be a two step solution. The Geolocation stuff being subscription based, and the TZ side either self hosted or subscription. – Steve -Cutter- Blades Mar 11 '21 at 11:39

1 Answers1

0

Address geolocation is a hard problem. It requires deep understanding of address systems and reacting to ever-changing, real-world, messy scenarios.

For example, you could get a database of the Zip codes of the United States and their approximate locations, but it would only be a snapshot. You'd find over time that new Zip codes would be added and missing from your data, and that existing Zip codes had been expanded to include other areas. You'd also find many Zip codes that are "non-locatable", such as those used to send mail to military overseas. You could even find a single Zip code that has addresses in two different time zones.

Take international concerns into effect and you'll find all sorts of edge cases. Every country and territory has their own special rules and situations.

It is a problem worth paying a service provider for. Trying to do geolocation in an offline manner might be possible, but it isn't advised.

The second part - figuring out which time zone goes to a location, is also messy. However it's slightly easier to coordinate. The Time Zone Boundary Builder is the main open-source project that attempts this. Most libraries referenced here use that data. But even then, it has updates and relies on borders established by Open Street Map data. Some of those borders are in dispute, so a service from Google, Microsoft, or others could give different results because they have map data with different borders. If you care about such things then you might want to test some edge cases against the different providers to see if you're satisfied with the results. You may find that the TZBB data works well, or you might prefer one of the online solutions.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575