NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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 '20, 11:10

gtludwig's gravatar image

gtludwig
26113
accept rate: 0%


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 '20, 22:19

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

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

permanent link

answered 13 Feb '20, 19:23

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×107
×18
×4

question asked: 11 Feb '20, 11:10

question was seen: 6,772 times

last updated: 14 Feb '20, 22:19

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum