Expand description
Fast timezone finder for Rust: convert (longitude, latitude) coordinates to timezone names, offline.
Version 2 is protobuf-free: the data source is the TZF embedded binary
format (.tzb) shipped by tzf-dist, and two finder mechanisms consume
it:
DefaultFinder— the recommended general-purpose finder. Expands the file’s geometry into materialized polygons at load time and answers most queries from the FUZZY preindex tiles, falling back to exact point-in-polygon for boundary cases.EmbeddedFinder— the low-memory finder. Queries the.tzbbytes in place (no expansion; roughly the file size plus a small open-time index of chunk skip blocks and per-group latitude stripes, ~100 KB on lite), with the same FUZZY fast path. Queries are slower thanDefaultFinder; results are identical.
use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();
assert_eq!("Asia/Shanghai", finder.get_tz_name(116.3883, 39.9289));Creating a finder is expensive — build one and share it (e.g. via
std::sync::LazyLock).
Structs§
- Boundary
File - Default
Finder - The recommended finder: FUZZY preindex fast path over materialized
polygon geometry, loaded from a
.tzbfile. - Embedded
Finder - The low-memory finder: queries TZF embedded binary (
.tzb) bytes in place, without expanding the geometry. Total footprint is roughly the file itself (the bundled lite data is ~4 MB) plus the timezone names and a 16-bytes-per-16-chunks skip table built while validating the file at open (~6 KB for lite, ~20 KB for full at the encoder’s default 256-point chunks). - Feature
Item - Geometry
Define - Properties
Define
Enums§
- Error
- Errors reported by the
.tzbreader.
Functions§
- deg2num
- deg2num is used to convert longitude, latitude to Slippy map tilenames under specific zoom level.