tzgeolookup – Lookup timezone names for geographic coordinates
(require tzgeolookup) | package: tzgeolookup |
This package allows determining the time zone name for any geographic coordinate on earth. It works entirely off-line, without having to contact any web service for this information.
This package only returns the time zone name, but it can be used in conjunction with the tzinfo package, which provides functions to determine the time offset for a time zone.
procedure
(lookup-timezone latitude longitude) → string?
latitude : real? longitude : real?
The function will always return a time zone string. If the location is not inside a time zone defined by a geopolitical area, the nautical time zone for that location is returned instead. This is a string in the format "Etc/UTC+number".
Timezone boundaries sometimes overlap, and the stored data in this package also contains imprecisions. It is possible that this function will return the wrong time zone if the location is within a few hunred meters from a timezone boundary. See also lookup-timezone*.
Note: sometimes location data is provided in "easting" and "northing" coordinates, which follow the mathematical X, Y notation. with "easting" being the longitude and "northing" being the latitude.
procedure
(lookup-timezone* latitude longitude) → (listof string?)
latitude : real? longitude : real?
Multiple time zones will be returned when the location is in an area where time zones overlap or when the location is within a few hundred meters from a time zone boundary. The actual time zone will always be in the returned list.
procedure
Lookups are faster when the data is cached, this function should only be called if the program knows it won’t do timezone lookups for a while.