Go library that maps IANA timezone names to the approximate geographic coordinates of their reference cities.
Coordinates are parsed from the IANA timezone database zone1970.tab file, embedded at build time via go:embed. No runtime dependencies or network access required.
go get github.com/13rac1/tzcoord
// Look up by timezone name
coord, ok := tzcoord.Lookup("America/New_York")
// coord.Lat = 40.7142, coord.Lon = -74.0064
// Auto-detect from system timezone
coord, err := tzcoord.LookupLocal()
if err != nil {
log.Fatal(err)
}LookupLocal detects the system timezone via $TZ, /etc/localtime symlink, or time.Local. Works on macOS and Linux.
Download the latest from IANA:
curl -o zone1970.tab https://data.iana.org/time-zones/data/zone1970.tab
Apache 2.0