h3-pg
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Security Assessment
About h3-pg
The h3-pg skill provides PostgreSQL bindings for the H3 hexagonal grid system, enabling seamless integration of H3 cells within PostgreSQL databases. It is designed to facilitate operations such as spatial indexing, geometry/geography integration, and raster analysis for users working with geospatial data. By providing H3-specific functionality, this skill makes it easier to work with hexagonal grids in Postgres, offering a wide range of tools for both basic and advanced geospatial analyses.
FAQ
How do I install and enable the h3-pg extension?
To install h3-pg, you need to create the necessary extensions in PostgreSQL. Run `CREATE EXTENSION h3` for core H3 bindings and `CREATE EXTENSION h3_postgis` for PostGIS integration, if you need support for geometry/geography casts and raster functions.
What PostGIS features does h3-pg support?
The h3-pg extension supports various PostGIS features such as direct casts for geometry and geography, boundary helpers, polygon fills, and raster integration for statistical analysis and raster clipping.
Are there any compatibility requirements for using h3-pg?
Yes, the `h3_postgis` extension requires PostGIS to be installed. Additionally, if you're using raster functions, the `postgis_raster` extension is required.
What is the difference between h3 and h3_postgis extensions?
The `h3` extension provides core H3 functionalities like indexing, hierarchy traversal, and basic operators, while the `h3_postgis` extension integrates PostGIS features, including geometry/geography casts, boundary helpers, raster analysis, and polygon fill capabilities.
Are there any limitations or potential issues when using h3-pg?
One known issue involves cells crossing the antimeridian (180°), which are split into valid polygons. In such cases, using `ST_Centroid` on a split polygon might result in centroids falling outside the cell, so it’s recommended to use `h3::geometry` for accurate centroid calculations.
Install h3-pg
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
postgis/h3-pg