tzf

pg_tzf : Fast lookup timezone name by GPS coordinates

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1680
tzf
pg_tzf
0.2.3
GIS
MIT
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
postgis
geoip
pg_cron
postgis_topology
postgis_raster
postgis_sfcgal
postgis_tiger_geocoder
address_standardizer

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.2.3
18
17
16
15
14
pg_tzf-
RPM
PIGSTY
0.2.3
18
17
16
15
14
pg_tzf_$v-
DEB
PIGSTY
0.2.3
18
17
16
15
14
postgresql-$v-tzf-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
el8.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
el9.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
el9.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
el10.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
el10.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
d12.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
d12.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
d13.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
d13.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
u22.x86_64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
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
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
u24.aarch64
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3
PIGSTY 0.2.3

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 via package name, for the active PG version
pig install tzf;		# install by extension name, for the current active PG version

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
pig install tzf -v 14;   # install for PG 14

Create this extension with:

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 updated on