/tzgeolookup

Racket pakcage to find the timezone for a location based on GPS coordinates

Primary LanguageRacketOtherNOASSERTION

tzgeolookup

This package can be used to find the timezone name for a location based on latitude/longitude GPS coordinates. The package works entirely off-line, that is, it does not query any web service for this information. Usage:

> (require tzgeolookup)
> (lookup-timezone 40.7092 -74.0151)
"America/New_York"

This package can be used in conjunction with the tzinfo package to determine the time zone offset and daylight saving information for a given location:

> (require tzinfo tzgeolookup)
> (utc-seconds->tzoffset (lookup-timezone 40.7092 -74.0151) (current-seconds))
(tzoffset -14400 #t "EDT")

You can install the package using a "raco pkg" command:

raco pkg install tzgeolookup

Overview

This package provides a single function lookup-timezone which takes a latitude and longitude coordinate and returns a string, representing the IANA time zone name for that location.

Previous implementation

The previous implementation was described in this and this blog post. In addition to what is described there, this implementation uses a custom serialization format, which saves another 10Mb over the compressed FASL files described in the blog posts. That implementation is available at commit 93abcae2b9ab1b77004cf65fbdc0a291680bc734.

Updating

The package contains the timezone boundary information inside, which means it has no external dependencies. This data rarely changes, but when it does, the data set can be regenerated by following instructions from the readme.md file in the tools directory.