Skip to content

tzf

Fast lookup timezone name by GPS coordinates

pg_tzf · Fast lookup timezone name by GPS coordinates

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1680tzfpg_tzf0.4.0GISMITRust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.4.019 18 17 16 15pg_tzf-
RPMPIGSTY0.4.019 18 17 16 15pg_tzf_$v-
DEBPIGSTY0.4.019 18 17 16 15postgresql-$v-tzf-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.3.1PIGSTY 0.3.1PIGSTY 0.3.1PIGSTY 0.3.1
el8.aarch64N/APIGSTY 0.3.1PIGSTY 0.3.1PIGSTY 0.3.1PIGSTY 0.3.1
el9.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
el9.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
el10.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
el10.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
d12.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
d12.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
d13.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
d13.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u22.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u22.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u24.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u24.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u26.x86_64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0
u26.aarch64PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0PIGSTY 0.4.0

Source

pig build pkg pg_tzf;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install pg_tzf;		# install by package name
pig install tzf;		# install by extension name

pig install tzf -v 19;   # install for PG 19
pig install tzf -v 18;   # install for PG 18
pig install tzf -v 17;   # install for PG 17
pig install tzf -v 16;   # install for PG 16
pig install tzf -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION tzf;

Usage

Sources:

tzf 0.4.0 looks up timezone names from longitude and latitude. The source package is pg_tzf, while the SQL extension name is tzf. Current builds support PostgreSQL 15–19; PostgreSQL 14 belongs to earlier releases. Installation requires a superuser and needs no preload or restart.

Create the extension

CREATE EXTENSION tzf;

The upstream project packages one build artifact per PostgreSQL major version.

Functions

Coordinate lookup:

SELECT tzf_tzname(116.3883, 39.9289) AS timezone;

Batch coordinate lookup:

SELECT unnest(
  tzf_tzname_batch(
    ARRAY[-74.0060, -118.2437, 139.6917],
    ARRAY[40.7128, 34.0522, 35.6895]
  )
) AS timezones;

Point lookup:

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

Batch point lookup:

SELECT unnest(
  tzf_tzname_batch_points(
    ARRAY[
      point(-74.0060, 40.7128),
      point(-118.2437, 34.0522),
      point(139.6917, 35.6895)
    ]
  )
) AS timezones;

Compatibility

Use longitude before latitude and keep paired arrays aligned. Version 0.4.0 adds PostgreSQL 19 support with pgrx 0.20.1; the four lookup APIs remain available. Select the artifact matching the server major version.

Table reader