How uber/h3 works
H3 is a C geospatial indexing library that maps latitude/longitude to hierarchical hexagonal cell indexes and supports operations on those cells. The documented command-line workflow converts a location to a cell, then reports its boundary or center; the library also covers neighborhoods, hierarchy, polygon filling, and geometry. The tree and excerpts show the core indexing, grid, and geometry modules, plus a website explorer. Some CLI and library implementation details were not sampled, so their connections are documented at the product level rather than inferred from filenames.
Main entry points: h3Index.c Cell indexes · map.jsx Hex map layers · algos.c Grid algorithms · index.tsx Explorer interface
Components 22
Command-line tools
- H3 CLI
src/apps/filters/latLngToCell.c - Boundary CLI
src/apps/filters/cellToBoundary.c - Center CLI
src/apps/filters/cellToLatLng.c
Indexing and grids
- Cell indexes
src/h3lib/lib/h3Index.c - Face projection
src/h3lib/lib/faceijk.c - Base cells
src/h3lib/lib/baseCells.c - Grid algorithms
src/h3lib/lib/algos.c - Local coordinates
src/h3lib/lib/localij.c - Directed edges
src/h3lib/lib/directedEdge.c - Cell iterators
src/h3lib/lib/iterators.c
Geospatial operations
- Coordinate utilities
src/h3lib/lib/latLng.c - Area metrics
src/h3lib/lib/area.c - Polygon filling
src/h3lib/lib/polyfill.c - Polygon geometry
src/h3lib/lib/polygon.c - Cell boundaries
src/h3lib/lib/cellsToMultiPoly.c - Linked geometry
src/h3lib/lib/linkedGeo.c
Web explorer
- Explorer interface
website/src/components/explorer/index.tsx - Hex map layers
website/src/components/explorer/map.jsx - Visible hex generation
website/src/components/explorer/useHex.ts - Input parsing
website/src/components/explorer/parseInput.ts
Other components
- User
- h3-js binding
Connections 22
- User → H3 CLI: requests cell
README.md - H3 CLI → Cell indexes: converts location
- User → Boundary CLI: requests boundary
README.md - Boundary CLI → Cell indexes: reads cell index
- User → Center CLI: requests center
README.md - Center CLI → Cell indexes: reads cell index
- Cell indexes → Face projection: uses projection
src/h3lib/lib/h3Index.c - Cell indexes → Base cells: uses base cells
src/h3lib/lib/h3Index.c - Grid algorithms → Base cells: uses neighbors
src/h3lib/lib/algos.c - Grid algorithms → Cell indexes: uses cell indexes
src/h3lib/lib/algos.c - Local coordinates → Cell indexes: uses cell indexes
- Directed edges → Cell indexes: uses cell indexes
- Cell iterators → Cell indexes: iterates cells
- Cell indexes → Face projection: projects coordinates
src/h3lib/lib/faceijk.c - Explorer interface → Input parsing: parses input
website/src/components/explorer/index.tsx - Explorer interface → Hex map layers: renders map
website/src/components/explorer/index.tsx - Hex map layers → Visible hex generation: uses hex layers
website/src/components/explorer/map.jsx - Visible hex generation → h3-js binding: fills polygons
website/src/components/explorer/useHex.ts - Hex map layers → User: shows map
- Polygon filling → Polygon geometry: processes polygons
- Cell boundaries → Linked geometry: builds boundaries
- Area metrics → Coordinate utilities: uses coordinates