3 ms·
> The geo lookup would be expensive computationally Not really? There's not that many timezones, globally, and I think their polygon data is in OSM / could be
by deathanatos 2y ago
> The geo lookup would be expensive computationally
Not really? There's not that many timezones, globally, and I think their polygon data is in OSM / could be obtained from OSM. Simply brute-force colliding a single point with all of them I would expect to be basically "instantaneous", but there are a number of trivial optimizations, like bounding boxes, that you could do to speed it up.
(Point-in-polygon is not terribly expensive; it's O(segments) in your polygon.)
That said, there are problems with that, as you mention. I just don't think "computationally expensive" is one of them.
- simonw 2y agoOddly enough I built an API a few years ago that does exactly that, using timezone polygons derived from OpenStreetMap: https://timezones.datasette.io/timezones/by_point?longitude=-116.23&latitude=43.61 https://timezones.datasette.io/timezones/by_point?longitude=...