react-native-nitro-h3 brings Uber's H3, the hexagonal hierarchical geospatial index, to React Native on iOS and Android.
It vendors the H3 C sources and calls them directly from C++ instead of running them through JavaScript.
- ⚡ Up to ~800× faster than
h3-js - 🧬 H3 as compiled C++, called through Nitro Modules
- 🔢
bigintcell indexes instead of hexadecimal strings - 📦 Typed-array results over the native buffer
- 🧵 Batch calls for whole coordinate and cell arrays
- ⏱️ Async variants on a background thread
- 🔁 The
h3-jsnames and a migration guide
Install from npm together with Nitro Modules and see Getting Started.
bun add react-native-nitro-h3 react-native-nitro-modules
cd ios && pod installOne coordinate and one resolution give one cell, and one cell gives its neighbours as a typed array over the native buffer:
import { latLngToCell, gridDisk, cellToString } from 'react-native-nitro-h3'
// H3 cell for San Francisco at resolution 9
const cell = latLngToCell(37.7749, -122.4194, 9) // 617700169957507071n
const id = cellToString(cell) // '89283082803ffff'
// The cell and its six neighbours, as one BigUint64Array
const neighbours = gridDisk(cell, 1) // BigUint64Array(7)Coming from h3-js, read the migration guide.
- Getting Started
- Requirements
- API
- Migration
- Showcase App
- Example App: benchmark
- Contributing
- llms.txt
react-native-nitro-h3 is released under the MIT licence, and the vendored H3 C sources under third_party/h3 keep their Apache-2.0 LICENSE and NOTICE files.
