A wrapper for DGGRID in Web Assembly. Based on last DGGRID c++ library developed by Dr. Kevin
------------Please check tests
folder for more examples.
in browser
const WebdggridLocal = await import("../dist/index.js").then(m => m.Webdggrid).catch(console.log);
import { Webdggrid as WebdggridExternal } from "https://cdn.jsdelivr.net/npm/webDggrid/dist/index.js";
const Webdggrid = WebdggridLocal ?? WebdggridExternal;
const webdggrid = await Webdggrid.load();
const seqNum = dggs.geoToSequenceNum([[0, 0]]);
In nodejs
import { Webdggrid } from 'webdggrid'
const dggs = await Webdggrid.load();
const seqNum = dggs.geoToSequenceNum([[0, 0]]);
Grid Creation
Grid Statistics
Grid Conversions
Slow development pace.
1.0.5
- Added support to
SeqNumGrid
Make sure to setup emscripten
on your machine.
The development process involves modifying the cpp
code and use utils/make.js
to build the library.
Folder | Desc |
---|---|
src-cpp | The src file of the DGGRID. It is inspired from DGGRIDR project. |
src-ts | The src file js wrapper around the emscripten code to make it easier to interact with library in more js friendly approach. |
lib-wasm | The js output that emscripten generates |
lib-wasm-py | experimental python wrapper |
tests | JS unit tests |
To build the entire library simply run
yarn build
It will build webassembly file and also builds the typescript wrapper.
Run the following command. It will open the emscripten's default page to test the wasm file. Just navigate to libdggrid.html
yarn serve
you can invoke the functions similar to
Module.DgGEO_to_SEQNUM(0,0,0,4,10,'HEXAGON','ISEA',[0],[0])
``