1

Is there an API endpoint that would retrieve a timezone passing the name of a city or town as a parameter? While not all cities or towns have unique names (a quick test would be to google for "list of cities with name Paris"), depending on the API call result, one could easily work around that.

asked 11 Feb, 11:10

gtludwig's gravatar image

gtludwig
26113
accept rate: 0%


2 Answers:
1

Usually it's a two step process: convert address to coordinates (geocoding), lookup timezone using the coordinates. While https://nominatim.openstreetmap.org/ can do the first part it doesn't have the data for the timezone. Well, technically it can be extracted from OSM data but it's complex and hard to maintain. https://github.com/evansiroky/timezone-boundary-builder does that. Then you only have the timezone name, the calculation what time it is in the city is also complex because you need to know if there's daylight saving time, whose rules differ from country to country. Not all APIs can handle coordinates in the ocean (https://en.wikipedia.org/wiki/Nautical_time).

There are a couple of businesses that offer timezone API, check https://stadiamaps.com/products/geospatial-apis/ , https://opencagedata.com/ , https://timezonedb.com/references/get-time-zone , https://www.timeanddate.com/services/api/

disclaimer: I work for opencagedata

permanent link

answered 14 Feb, 22:19

mtmail's gravatar image

mtmail
3.8k1059
accept rate: 30%

0

No (if you mean an API provided by the OSMF or any of the "core" OSM services).

permanent link

answered 13 Feb, 19:23

SimonPoole's gravatar image

SimonPoole ♦
40.0k13297634
accept rate: 19%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×91
×14
×4

question asked: 11 Feb, 11:10

question was seen: 311 times

last updated: 14 Feb, 22:19

powered by OSQA