tzfpy
Probably the fastest Python package to convert longitude/latitude to timezone name
What it is and what it does
tzfpy is a Python binding to a Rust-based timezone lookup engine that maps geographic coordinates to IANA timezone names. It uses simplified polygon boundaries (Douglas-Peucker simplification with 0.001-degree epsilon) to keep memory usage around 70 MB while maintaining boundary accuracy within 111 m. The package is designed for speed: queries run in nanoseconds after the first lazy-initialized call, and it includes optional GeoJSON export for visualization and an index mode that trades 5 MB of additional memory for faster queries near timezone borders.
The package supports Python 3.10 and later with pre-built wheels for macOS (Intel and ARM), Linux (x86_64 and ARM64), and Windows. It can be installed with optional extras for compatibility with pytz or tzdata, and integrates with Python's standard zoneinfo module.
Use it for:
- Batch-process GPS logs or location data to assign timezone names for time-aware analysis.
- Build location-based services that need to display local time without external API calls.
- Visualize timezone boundaries and coverage areas by exporting GeoJSON polygons.
- Embed timezone lookup in high-throughput applications where query latency matters.
- Validate or enrich geographic datasets with timezone information offline.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts geographic coordinates (longitude/latitude) to timezone names using simplified polygon data, with optional GeoJSON export for visualization.
Yes, if you need fast offline timezone lookup from coordinates. The package is actively maintained, has no known vulnerabilities, uses MIT license, and covers Python 3.10+ with pre-built wheels. Install with the tzdata extra for compatibility. The 111 m boundary accuracy and ~70 MB memory footprint are documented tradeoffs; verify they fit your constraints before adopting.
Install
tzfpy on PyPI
pip
pip install tzfpyuv
uv add tzfpypoetry
poetry add tzfpyInstalling tzfpy
Before you install
Medium friction due to compiled Rust bindings, but pre-built wheels cover Python 3.10+ and common platforms. Active maintenance with release 4 days old.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open and closed projects.
Quickstart
pip install tzfpy
from tzfpy import get_tz
tz = get_tz(116.3883, 39.9289) # longitude, latitude
print(tz) # 'Asia/Shanghai'
Requires Python 3.10 or later. First call triggers lazy initialization and may be noticeably slower than subsequent calls.
Verify before relying
- Whether the 111 m boundary accuracy is sufficient for your use case (measured against 2026c dataset).
- Whether the ~70 MB memory footprint is acceptable in your deployment environment.
- Whether timezone names may differ from pytz or tzdata in edge cases when not using optional compatibility extras.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,768,262/month — #2,237 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tzfpy-1.3.3-cp310-abi3-macosx_10_12_x86_64.whl; tzfpy-1.3.3-cp310-abi3-macosx_11_0_arm64.whl; tzfpy-1.3.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tzfpy-1.3.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tzfpy-1.3.3-cp310-abi3-musllinux_1_2_aarch64.whl; tzfpy-1.3.3-cp310-abi3-musllinux_1_2_x86_64.whl; tzfpy-1.3.3-cp310-abi3-win_amd64.whl; tzfpy-1.3.3-cp314-cp314t-macosx_10_12_x86_64.whl; tzfpy-1.3.3-cp314-cp314t-macosx_11_0_arm64.whl; tzfpy-1.3.3-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tzfpy-1.3.3-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tzfpy-1.3.3-cp314-cp314t-musllinux_1_2_aarch64.whl; tzfpy-1.3.3-cp314-cp314t-musllinux_1_2_x86_64.whl; tzfpy-1.3.3-cp314-cp314t-win_amd64.whl
Keywords: tzf, timezone, timezone-name, timezone-lookup, gps, gps-coordinates, gps-location, longitude, latitude
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
timezonefinderLooks up the timezone for any WGS84 coordinate…
unclear · top 5,000 on PyPI
tzwhereLooks up the IANA timezone name for a given…
permissive · top 15,000 on PyPI
pytzdataProvides access to the Olson timezone database…
permissive · top 5,000 on PyPI
tzlocalReturns the IANA timezone name and tzinfo…
permissive · top 1,000 on PyPI
pytzpytz brings the Olson timezone database into…
permissive · top 100 on PyPI
django-timezone-fieldProvides Django database, form, and REST…
permissive · top 5,000 on PyPI
pyzipcodeProvides local lookup of US ZIP code…
permissive · top 15,000 on PyPI
tzdataProvides IANA time zone data as a Python…
permissive · top 100 on PyPI
suntimeCalculates sunrise and sunset times for any…
copyleft · top 15,000 on PyPI
pytz-deprecation-shimProvides drop-in timezone shims that support…
permissive · top 5,000 on PyPI