---
name: "uber-h3-hexagonal-spatial-index"
description: "Partition geographic coordinates into multi-resolution hexagonal grid cells using Uber H3."
metadata:
  author: "Uber"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "lat lng to h3 index"
  - "polygon polyfill h3"
  - "h3 grid aggregation"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Uber H3 Hierarchical Hexagonal Spatial Indexing

Implements spatial analytics using Uber H3: converting lat/lng to H3 index tokens, finding k-ring neighbors, compacting and uncompacting cell sets, polyfilling polygons, and running high-speed spatial aggregations.

## When to Invoke
Invoke this skill whenever you need to:
- lat lng to h3 index
- polygon polyfill h3
- h3 grid aggregation

## Execution SOP & Rules
1. Convert coordinate: cell = h3.geo_to_h3(lat, lng, resolution=8) or h3.latlng_to_cell(lat, lng, 8).
2. Retrieve neighboring cells: neighbors = h3.grid_disk(cell, k=2) for proximity lookups.
3. Aggregate metrics: group records by h3_cell string identifier instead of slow geometric point-in-polygon checks.
4. Compact cells: h3.compact_cells(cell_set) to optimize storage of large continuous geographic zones.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
