WhereTZ is a small gem for lookup of timezone by georgraphic coordinates.
Features:
TZInfo::Timezone
.Install it with your usual routines (Gemfile or gem install
) as wheretz
gem. Then:
require 'wheretz'
WhereTZ.lookup(50.004444, 36.231389) # (lat, lng) order
# => 'Europe/Kiev'
WhereTZ.get(50.004444, 36.231389)
# => #<TZInfo::DataTimezone: Europe/Kiev>
# you should have tzinfo gem installed, wheretz doesn't list it as dependency
From command-line, after gem installed:
wheretz 50.004444,36.231389
# => Europe/Kiev
data/*.geojson
files;WhereTZ
first checks provided coordinates by bounding boxes, and if only one bbox (extracted from filename) corresponds to them, returns timezone name immediately;WhereTZ
reads only relevant timezone files (which are not very large) and checks which polygon actually contains the point..geojson
files can be uneffective when called multiple times; future releases will provide option for preserve data in memory, or for mass lookup of points;Data license is ODbL.
Code license is usual MIT.