Skip to main content
Coordinate to IANA timezone lookup

Offline timezone lookup for WGS84 coordinates, with no polygon simplification - so the answer stays correct at timezone borders.

https://github.com/jannikmi/timezonefinder/actions/workflows/build.yml/badge.svg?branch=master documentation status https://img.shields.io/pypi/wheel/timezonefinder.svg pre-commit total PyPI downloads latest version on PyPI latest version on conda-forge supported python versions linted and formatted with ruff

In comparison to other alternatives this package aims at maximum accuracy around timezone borders while offering fast lookup performance and compatibility with many (Python) runtime environments. It combines preprocessed polygon data, H3-based spatial shortcuts, and optional acceleration via Numba or a clang-backed point-in-polygon routine.

Quick Guide

It is recommended to install it together with the optional Numba package for increased performance:

pip install timezonefinder[numba]

The timezone boundary data is installed automatically as the separate timezonefinder-data distribution, so that a new dataset ships without a new timezonefinder release. Pin it to hold a deployment to one dataset - the release history lists the versions to choose from: pip install timezonefinder "timezonefinder-data==<version>".

# use the global function for convenience:
from timezonefinder import timezone_at

tz = timezone_at(lng=13.358, lat=52.5061)  # 'Europe/Berlin'


# For improved performance and control, create and reuse an instance:
from timezonefinder import TimezoneFinder

tf = TimezoneFinder(in_memory=True)  # reuse

query_points = [(13.358, 52.5061), ...]
for lng, lat in query_points:
    tz = tf.timezone_at(lng=lng, lat=lat)  # 'Europe/Berlin'

Note: This library uses the full original timezone dataset with all >440 timezone names, providing full localization capabilities and historical timezone accuracy. For applications that prefer a smaller memory footprint, the reduced “timezones-now” dataset is available via the update_data.sh script (cf. Documentation).

How it works

A lookup scales the coordinates to 32-bit integers (x 10^7, ~1 cm resolution), finds the point’s H3 hexagon at resolution 3, and reads a precomputed shortcut for that cell. Most cells are covered by a single timezone, so the answer is returned immediately with no geometry touched at all. Only an ambiguous cell falls through to the polygons it lists: bounding-box rejection first, then a ray-casting point-in-polygon test - holes before the outer ring, since holes are smaller and can reject the polygon outright.

The central trade-off: the boundary polygons are never simplified, so border accuracy is limited only by the source dataset. The H3 index is what makes carrying full-resolution geometry affordable.

Since the dataset includes ocean zones, every coordinate on earth matches some timezone - use timezone_at_land() when you need to tell land from sea.

Performance

Hundreds of thousands of lookups per second on a single core for uniformly random query points. The exact figure depends on the acceleration backend, the machine and the dataset version, so the benchmark reports below carry it - each states the configuration it was measured in - rather than this page, which would go stale.

The point-in-polygon routine has three interchangeable backends, selected at import time: a clang-compiled C extension (built automatically when a compiler is available), Numba JIT compilation (preferred when the optional dependency is installed), and pure Python. The pure-Python fallback is ~400x slower and always correct - a missing compiler costs speed, never results.

Engineering notes

  • Architecture - the lookup pipeline, the acceleration backends, and the ceilings this package deliberately does not exceed

  • Data Format - binary layouts, coordinate scaling and the H3 index

  • Benchmarking Methodology - the measurement design and where every threshold comes from

  • Testing philosophy - the tests that exist because a rule needed a failure mode, plus the property-based suite and the version/backend matrix

  • How it ships - abi3 wheels, three libc targets, and the checks that stop a broken wheel reaching PyPI

  • Alternatives - the trade-offs against tzfpy, and when to choose it instead

  • Changelog

Alternative: Need maximum speed at the cost of accuracy? Check out tzfpy - a fast and lightweight alternative based on Rust.

Contributing

Looking for maintainers. Reach out if you want to contribute!

Contribution guidelines, the development workflow and the testing/benchmarking gates are documented in CONTRIBUTING.md.

References

LICENSE

timezonefinder is licensed under the MIT license.

The data ships in the separate timezonefinder-data distribution and is licensed under the ODbL license, following the base dataset from evansiroky/timezone-boundary-builder.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timezonefinder-8.3.0.tar.gz (764.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

timezonefinder-8.3.0-cp311-abi3-musllinux_1_1_x86_64.whl (85.9 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.1+ x86-64

timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (83.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file timezonefinder-8.3.0.tar.gz.

File metadata

  • Download URL: timezonefinder-8.3.0.tar.gz
  • Upload date:
  • Size: 764.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for timezonefinder-8.3.0.tar.gz
Algorithm Hash digest
SHA256 827c056552d7ba481336e62fff58f3a7c81687233d5dc000b13fefaa25c89525
MD5 0508e59e30a47218a2c9ed495e363c67
BLAKE2b-256 073c78a7ce494c0d83cec7c1619a7ac76a751df06adbcc11dc7f90733ef3ecb2

See more details on using hashes here.

File details

Details for the file timezonefinder-8.3.0-cp311-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for timezonefinder-8.3.0-cp311-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 2f14364389fceec16915826bc6701bccc074b0159269d0447c8bcf0d647d509b
MD5 690b0c1bdf951afdbf9f15fc395a254b
BLAKE2b-256 73e90c582a773c6d1335544559e52ea5534211706b488bd601bf2a9ff5b78c5c

See more details on using hashes here.

File details

Details for the file timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 61c41ddb7d0518c4df668b705e01c0523e1ca496d75c5721b30a1b03ddd9ae75
MD5 cc1225593b531791e250625f08b054f6
BLAKE2b-256 d335171e01f0940e979c3a4c6a0562996a4ba9a424adca671663ce0c9a244231

See more details on using hashes here.

File details

Details for the file timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for timezonefinder-8.3.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d2413777e443f45260128cdb58db449b16c7783ce414de499475d81500dd5bdf
MD5 9392eae6a83da18eafe08ce0a766c03e
BLAKE2b-256 0e1f65048c4d530e0781d43433b8863551352df4b04d4667089624a584ad6de6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

8.3.0 This release

4 files

8.2.5

4 files

8.2.4

4 files

8.2.3

3 files

8.2.2

3 files

8.2.1

3 files

8.2.0

3 files

8.1.0

3 files

8.0.0

11 files

7.0.2

11 files

7.0.1

11 files

7.0.0

6.6.3

11 files

6.6.2

11 files

6.5.9

19 files

6.5.8

13 files

6.5.7

13 files

6.5.6

13 files

6.5.5

7 files

6.5.4

7 files

6.5.3

6 files

6.5.2

6 files

6.5.1

6 files

6.5.0

2 files

6.4.1

2 files

6.4.0

2 files

6.3.0

2 files

6.2.0

2 files

6.1.10

2 files

6.1.9

2 files

6.1.8

2 files

6.1.7

2 files

6.1.6

2 files

6.1.5

2 files

6.1.4

2 files

6.1.3

2 files

6.1.2

2 files

6.1.1

2 files

6.1.0

2 files

6.0.2

2 files

6.0.1

2 files

6.0.0

2 files

5.2.0

2 files

5.1.1

2 files

5.1.0

2 files

5.0.0

3 files

4.5.0

2 files

4.4.1

2 files

4.4.0

2 files

4.3.1

2 files

4.2.0

2 files

4.1.0

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

4.0.0

2 files

3.4.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page