tzf

Fast lookup timezone name by GPS coordinates

Overview

PackageVersionCategoryLicenseLanguage
pg_tzf0.2.3GISMITRust
IDExtensionBinLibLoadCreateTrustRelocSchema
1680tzfNoYesNoYesNoNo-
Relatedpostgis geoip pg_cron postgis_topology postgis_raster postgis_sfcgal postgis_tiger_geocoder address_standardizer

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.2.31817161514pg_tzf-
RPMPIGSTY0.2.31817161514pg_tzf_$v-
DEBPIGSTY0.2.31817161514postgresql-$v-tzf-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
u22.x86_64
u22.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
u24.x86_64
u24.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3

Build

You can build the RPM / DEB packages for pg_tzf using pig build:

pig build pkg pg_tzf         # build RPM / DEB packages

Install

You can install pg_tzf directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pg_tzf;          # Install for current active PG version
pig ext install -y pg_tzf -v 18  # PG 18
pig ext install -y pg_tzf -v 17  # PG 17
pig ext install -y pg_tzf -v 16  # PG 16
pig ext install -y pg_tzf -v 15  # PG 15
pig ext install -y pg_tzf -v 14  # PG 14
dnf install -y pg_tzf_18       # PG 18
dnf install -y pg_tzf_17       # PG 17
dnf install -y pg_tzf_16       # PG 16
dnf install -y pg_tzf_15       # PG 15
dnf install -y pg_tzf_14       # PG 14
apt install -y postgresql-18-tzf   # PG 18
apt install -y postgresql-17-tzf   # PG 17
apt install -y postgresql-16-tzf   # PG 16
apt install -y postgresql-15-tzf   # PG 15
apt install -y postgresql-14-tzf   # PG 14

Create Extension:

CREATE EXTENSION tzf;

Usage

tzf: Fast timezone lookup for PostgreSQL

Find timezone names from coordinates. Built on tzf-rs with timezone boundary data from timezone-boundary-builder.

CREATE EXTENSION tzf;

Functions

Look up timezone for a coordinate (longitude, latitude):

SELECT tzf_tzname(116.3883, 39.9289) AS timezone;
-- Asia/Shanghai

Look up timezone for a batch of coordinates:

SELECT unnest(
  tzf_tzname_batch(
    ARRAY[-74.0060, -118.2437, 139.6917],
    ARRAY[40.7128, 34.0522, 35.6895]
  )
) AS timezones;
-- America/New_York
-- America/Los_Angeles
-- Asia/Tokyo

Look up timezone for a point:

SELECT tzf_tzname_point(point(-74.0060, 40.7128)) AS timezone;
-- America/New_York

Look up timezone for a batch of points:

SELECT unnest(
  tzf_tzname_batch_points(
    ARRAY[
      point(-74.0060, 40.7128),
      point(-118.2437, 34.0522),
      point(139.6917, 35.6895)
    ]
  )
) AS timezones;
-- America/New_York
-- America/Los_Angeles
-- Asia/Tokyo

Performance

FunctionTPSNote
tzf_tzname~17,700Single coordinate lookup
tzf_tzname_point~17,600Single point lookup
tzf_tzname_batch~51Batch of 1000 = ~51,000 TPS
tzf_tzname_batch_points~32Batch of 1000 = ~32,000 TPS

Last Modified 2026-03-12: add pg extension catalog (95749bf)