a5pg
a5pg · Equal-area A5 spatial index functions for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100947 | a5pg | a5pg | 0.6.1 | GIS | Apache-2.0 | Rust |
PostgreSQL · 13, 14, 15, 16, 17, 18
Usage
Sources:
a5pg exposes A5 equal-area discrete global grid functions in PostgreSQL. Use it to convert longitude/latitude coordinates into hierarchical 64-bit cell identifiers for aggregation and mapping; it is not a PostGIS index access method, and the optional geometry wrapper is available only when a compatible geometry type exists.
Core Workflow
Choose a resolution for the analytical scale, persist the returned bigint cell ID with source rows, and group or join on that value. Validate resolution changes explicitly: a parent cell is coarser, while a5_cell_to_children expands to finer cells.
Important Objects
a5_lonlat_to_cellconverts longitude, latitude, and resolution to a cell ID.a5_cell_to_lonlatanda5_cell_to_boundaryreturn the center and polygon coordinate arrays.a5_get_resolution,a5_cell_to_parent, anda5_cell_to_childrennavigate the hierarchy.a5_point_to_cellis a PostGIS convenience wrapper whengeometryis already defined.a5pg_versionanda5pg_inforeport extension information.
Caveats
The control file makes version 0.6.1 non-relocatable, untrusted, and superuser-only to install. The manifest declares build features for PostgreSQL 13 through 18, while the reviewed README reports CI for 15 through 17; test the exact packaged server target.
Longitude/latitude order, coordinate reference system, cell-boundary handling, and chosen resolution are application semantics. Normalize inputs to WGS84 degrees, reject invalid coordinates, and regression-test joins near cell edges. A5 cell IDs are implementation identifiers rather than distances or globally sortable geographic coordinates.