h3o-wasm
TypeScript icon, indicating that this package has built-in type declarations

0.6.2-alpha.8 • Public • Published

h3o-wasm

Crates.io Docs.rs CI Status Coverage License

A Rust implementation of the H3 geospatial indexing system, compiled to WebAssembly for use in JavaScript projects.

Design

Experimental: this package compiles some functions from h3o to WASM. Performance might be slower than the reference h3-js implementation h3o is a Rust reimplementation of the H3 geospatial indexing system, designed with the following goals:

  • Leverage Rust's strong typing for safer usage.
  • Provide a 100% Rust solution, eliminating C dependencies for painless compilation to WebAssembly and easier link-time optimization.
  • Match or exceed the performance of the reference H3 library.

h3o-wasm exposes h3o functions to Javascript

Installation

The h3o-wasm package is distributed via npm.

npm install h3o-wasm

Cargo

  • Install the rust toolchain in order to have cargo installed by following this guide.
  • run cargo install h3o

Usage

import init, * as h3o from "h3o-wasm";
async function run() {
    await init(); // Initialize the WASM module
    const h3Index = h3o.latLngToCell(37.3615593, -122.0553238, 7);
    console.log("H3 Index: ", h3Index);
}
run();

Why this name?

Rust is an iron oxide. A Rust version of H3 is an H3 oxide, in other word $H_3O$ (a.k.a hydronium). Chemically speaking this is wrong ( $H_3O$ is produced by protonation of $H_2O$, not oxidation of $H_3$), but ¯\(ツ)

License

BSD 3-Clause

Package Sidebar

Install

npm i h3o-wasm

Homepage

docs.rs/h3o

Weekly Downloads

2

Version

0.6.2-alpha.8

License

BSD-3-Clause

Unpacked Size

116 kB

Total Files

6

Last publish

Collaborators

  • jcolot