H3 geospatial
Implementing, debugging, reviewing, or migrating Uber H3 geospatial indexing with h3-js or h3geo.org. Use for JavaScript/TypeScript tasks involving H3 hexagonal cells, point-to-cell bucketing, polygon coverage, GeoJSON conversion, resolution selection, hierarchy, traversal, compaction, directed edges, H3 errors, map visualization of H3 cells, or H3 v3-to-v4 function-name migration.From its SKILL.md
npx -y skills add flamel-ai/skills --skill h3-geospatialAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.3 KB, 943 tokens by cl100k_base, as published. Nobody here has run it
H3 Geospatial
Use this skill to work with Uber H3 in JavaScript/TypeScript, especially the h3-js package and the H3 4.x API documented at h3geo.org.
Workflow
- Confirm the installed or target version when exact API behavior matters. As of 2026-07-21,
h3-jslatest is4.5.0and binds H3 core4.5.0; re-checknpm view h3-js versionor the official README for version-sensitive work. - Choose the operation family before coding: indexing, inspection, hierarchy, traversal, regions, directed edges, vertices, metrics, or migration.
- Normalize coordinate order up front. Default h3-js coordinate pairs are
[lat, lng]; GeoJSON coordinate pairs are[lng, lat]. - Validate H3 indexes and resolutions before expensive calls. Resolutions are integers
0through15. - Estimate output size before
cellToChildren,gridDisk,polygonToCells, oruncompactCells; high resolutions can allocate huge arrays. - Add focused tests using small known cells and at least one coordinate-order assertion.
Source Order
- Prefer local project code and installed package types when editing an existing repo.
- Use the official
uber/h3-jsREADME and package types for JavaScript binding details. - Use h3geo.org 4.x docs for H3 concepts, cross-language behavior, resolution stats, and error-code semantics.
- If docs conflict, trust the installed
h3-jsversion for JavaScript names and signatures.
References
Load only the file needed for the current task:
references/api-map.md: API groups, import patterns, v4 names, v3 migration names, units, flags, and errors.references/coordinates-geojson.md: coordinate order, GeoJSON conversion, polygon inputs, boundaries, and map-rendering shapes.references/resolution-and-scale.md: resolution selection, scale table, output-size risks, and performance guidance.references/implementation-patterns.md: concrete JavaScript/TypeScript patterns for bucketing, aggregation, polygon coverage, map output, traversal, and tests.
Default Rules
- Import from
h3-js, not from the unrelatedh3HTTP framework package. - Prefer named ESM imports in modern code:
import { latLngToCell, cellToBoundary, polygonToCells } from "h3-js";
- Store H3 indexes as strings. Do not coerce them to JavaScript numbers; they are 64-bit hexadecimal identifiers.
- Use v4 function names in new code:
latLngToCell,cellToLatLng,cellToBoundary,polygonToCells,gridDisk,gridDistance,cellToParent,cellToChildren,compactCells,uncompactCells. - Do not use v3 names like
geoToH3,h3ToGeo,h3ToGeoBoundary,polyfill,kRing, orh3Distanceunless deliberately touching legacy code. - Treat H3 hierarchy as exact logical indexing, not exact geometric containment. A child cell belongs to a parent index logically, but cell boundaries are not always geometrically contained by the parent boundary.
- Use
polygonToCellsfor centroid-based polygon coverage. UsepolygonToCellsExperimentalwith explicitPOLYGON_TO_CELLS_FLAGSonly when the containment mode is part of the requirement. - Use
compactCellsto reduce storage or network payload for complete child sets;compactCellsrejects invalid inputs such as duplicate cells. - Catch h3-js errors around user-provided polygons, indexes, resolutions, and large expansions; H3 4.x generally throws instead of returning null-like failure values.
Verification
For code changes involving H3:
- Run a small point round trip:
latLngToCellthencellToLatLng. - For GeoJSON output, assert
cellToBoundary(cell, true)returns[lng, lat]pairs and a closed ring. - For polygon input, test both a default
[lat, lng]polygon and a GeoJSON[lng, lat]polygon withisGeoJson: truewhen applicable. - For traversal, include a pentagon-adjacent or error-path test when using
gridRingUnsafe, local IJ functions, or long paths. - For storage/query code, test duplicate handling and compaction/uncompaction at the intended resolution.
What ships with it: 5 files
18.0 KB alongside SKILL.md
agents/
- openai.yaml203 B
references/
- api-map.md5.3 KB
- coordinates-geojson.md3.5 KB
- implementation-patterns.md5.3 KB
- resolution-and-scale.md3.7 KB