Skip to content

H3 spatial indexing: hexagonal grid analytics, aggregation, and visualization #373

@mikemcdougall

Description

@mikemcdougall

Context

CARTO's entire analytics differentiator is H3 hexagonal grid indexing. H3 enables spatial aggregation at scale — billions of points aggregated into hexagonal cells for density analysis, movement patterns, and spatial joins. Increasingly expected for mobility, telco, logistics, insurance, and IoT analytics.

PostGIS supports H3 via the h3-pg extension. Uber's H3 is open-source and becoming a de facto standard.

Scope

Core Operations

  • H3 indexing: assign H3 cell index to features at configurable resolution (0-15)
  • Aggregation: group features by H3 cell → count, sum, avg, min, max per cell
  • Polyfill: fill a polygon with H3 cells at a given resolution
  • K-ring: get neighboring cells within K distance
  • Compact/uncompact: optimize cell sets across resolutions

API Endpoints

  • GET /rest/services/{id}/FeatureServer/{layerId}/h3?resolution=7&outStatistics=...
  • Returns H3 cell geometries with aggregated statistics
  • Compatible with GeoServices statistics response format
  • OGC API endpoint: /collections/{id}/h3?resolution=7

Visualization

  • H3 hexagonal grid as MVT tiles (dynamic resolution based on zoom)
  • MapLibre fill-extrusion for 3D hex visualization
  • Auto-generated choropleth style from aggregation values

Other Discrete Global Grids

  • S2 cells (Google standard) — optional secondary index
  • Quadbin (CARTO's quad-tree index) — for CARTO migration compatibility

Edition Gating

  • Community: none (H3 is an analytics acceleration feature)
  • Pro: H3 indexing, aggregation, MVT hex tiles, S2/Quadbin support

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/serverCore server (protocols, query, edits)edition/proPro edition featureeffort/L🌳 L: 1-2 days (complex feature, multiple components)enhancementNew feature or requestphase/BetaBeta scopepriority/P3📋 Low priority - nice to have in phase, can be deferred

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions