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 |
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 answered 14 Feb, 22:19 mtmail |
No (if you mean an API provided by the OSMF or any of the "core" OSM services). answered 13 Feb, 19:23 SimonPoole ♦ |