h3_postgis

H3 PostGIS integration

Overview

PackageVersionCategoryLicenseLanguage
pg_h34.2.3GISApache-2.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
1530h3NoYesNoYesNoYes-
1531h3_postgisNoYesNoYesNoYes-
Relatedh3 postgis postgis_raster mobilitydb postgis_topology postgis_sfcgal postgis_tiger_geocoder address_standardizer address_standardizer_data_us pgrouting pointcloud

pgdg missing el8.x86.pg17 and el8.x86.pg18

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG4.2.31817161514pg_h3h3, postgis, postgis_raster
RPMPGDG4.2.31817161514h3-pg_$v-
DEBPGDG4.2.31817161514postgresql-$v-h3-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PGDG MISSPGDG MISSPGDG 4.1.3PGDG 4.1.3PGDG 4.1.3
el8.aarch64PGDG 4.2.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3
el9.x86_64PGDG 4.2.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3
el9.aarch64PGDG 4.2.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3PGDG 4.1.3
el10.x86_64PGDG 4.2.3PGDG 4.2.2PGDG 4.2.2PGDG 4.2.2PGDG 4.2.2
el10.aarch64PGDG 4.2.3PGDG 4.2.2PGDG 4.2.2PGDG 4.2.2PGDG 4.2.2
d12.x86_64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
d12.aarch64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
d13.x86_64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
d13.aarch64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
u22.x86_64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
u22.aarch64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
u24.x86_64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3
u24.aarch64PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3PGDG 4.2.3

Install

You can install pg_h3 directly. First, make sure the PGDG repository is added and enabled:

pig repo add pgdg -u          # Add PGDG repo and update cache

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

pig install pg_h3;          # Install for current active PG version
pig ext install -y pg_h3 -v 18  # PG 18
pig ext install -y pg_h3 -v 17  # PG 17
pig ext install -y pg_h3 -v 16  # PG 16
pig ext install -y pg_h3 -v 15  # PG 15
pig ext install -y pg_h3 -v 14  # PG 14
dnf install -y h3-pg_18       # PG 18
dnf install -y h3-pg_17       # PG 17
dnf install -y h3-pg_16       # PG 16
dnf install -y h3-pg_15       # PG 15
dnf install -y h3-pg_14       # PG 14
apt install -y postgresql-18-h3   # PG 18
apt install -y postgresql-17-h3   # PG 17
apt install -y postgresql-16-h3   # PG 16
apt install -y postgresql-15-h3   # PG 15
apt install -y postgresql-14-h3   # PG 14

Create Extension:

CREATE EXTENSION h3_postgis CASCADE;  -- requires: h3, postgis, postgis_raster

Usage

h3_postgis: PostGIS integration for H3

h3_postgis is a bridge extension that integrates the H3 hexagonal hierarchical spatial index with PostGIS. It enables conversion between H3 indexes and PostGIS geometry types.

CREATE EXTENSION h3_postgis CASCADE;

This extension requires both h3 and postgis to be installed. It provides functions to convert between H3 cell indexes and PostGIS geometries, enabling spatial queries that combine H3’s hexagonal grid system with PostGIS’s spatial capabilities.

Key Functions

-- Convert a PostGIS point to an H3 cell index
SELECT h3_latlng_to_cell(ST_MakePoint(-73.985, 40.748)::point, 9);

-- Get the boundary of an H3 cell as a PostGIS geometry
SELECT h3_cell_to_boundary_geometry('892a1008003ffff'::h3index);

-- Convert H3 cells to PostGIS polygons for visualization
SELECT h3_cell_to_geometry('892a1008003ffff'::h3index);

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