h3_postgis
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_h3 | 4.5.0 | GIS | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1530 | h3 | No | Yes | No | Yes | No | Yes | - |
| 1531 | h3_postgis | No | Yes | No | Yes | No | Yes | - |
| Related | h3 postgis postgis_raster postgis qdgc pg_geohash pgrouting q3c pg_polyline pg_eviltransform earthdistance mobilitydb |
|---|
RPM and DEB 4.5.0 require h3, postgis and postgis_raster; point coordinates use longitude, latitude.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 4.5.0 | 1817161514 | pg_h3 | h3, postgis, postgis_raster |
| RPM | PIGSTY | 4.5.0 | 1817161514 | h3-pg_$v | - |
| DEB | PIGSTY | 4.5.0 | 1817161514 | postgresql-$v-h3 | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| el8.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| el9.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| el9.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| el10.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| el10.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| d12.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| d12.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| d13.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| d13.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u22.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u22.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u24.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u24.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u26.x86_64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
| u26.aarch64 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 | PIGSTY 4.5.0 |
Build
You can build the RPM / DEB packages for pg_h3 using pig build:
Install
You can install pg_h3 directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
h3_postgis bridges H3 cells with PostGIS geometry, geography, and raster. It requires h3, postgis, and postgis_raster, including for geometry-only use. Input geometries must use SRID 4326 with longitude, latitude coordinates; the functions do not reproject inputs.
Convert Points and Cells
Transform other coordinate systems to SRID 4326 with PostGIS before calling the H3 functions. Setting an SRID label alone does not transform coordinates.
Core API
| Task | Functions |
|---|---|
| Point to cell | h3_latlng_to_cell(geometry, integer), h3_latlng_to_cell(geography, integer) |
| Cell center | h3_cell_to_geometry, h3_cell_to_geography |
| Cell boundary | h3_cell_to_boundary_geometry, h3_cell_to_boundary_geography |
| Polygon coverage | h3_polygon_to_cells, h3_cells_to_multi_polygon_geometry, h3_cells_to_multi_polygon_geography |
| Continuous raster summaries | h3_raster_summary, h3_raster_summary_stats_agg |
| Categorical raster summaries | h3_raster_class_summary, h3_raster_class_summary_item_agg |
The geometry-to-resolution @ operator also maps a location to an H3 cell. Validate polygon inputs with ST_IsValid(); repairs through ST_MakeValid() can change topology and produce geometry collections, so retain and review polygonal components before coverage calculations. Invalid polygons have undefined behavior.
Summarize Raster Data
The default summary chooses a method; explicit clip, centroid, and subpixel variants let you control how raster pixels are assigned to cells. Review the choice against raster resolution and the requested H3 resolution.
Upgrade and Boundaries
The base extension update performs affected btree rebuilds and distance-dependent refreshes, so plan its maintenance window before updating the companion. Version 4.5.0 fixes restricted-search-path maintenance on PostgreSQL 17+, expression-index dump/restore, and several geometry and polygonization errors. Both extension versions should match. Install the matching 4.5.0 package files before updating either extension.
h3.extend_antimeridian should normally remain false for planar overlays. Both extensions are relocatable; ensure the schemas containing H3 and PostGIS objects are visible when issuing unqualified SQL. Neither extension requires shared preloading.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)