Skip to content

Latest commit

 

History

History
106 lines (67 loc) · 3.55 KB

readme.md

File metadata and controls

106 lines (67 loc) · 3.55 KB

Web Assembly version of DGGRID

A wrapper for DGGRID in Web Assembly. Based on last DGGRID c++ library developed by Dr. Kevin

NPM Version GitHub Actions Workflow Status GitHub Actions Workflow Status

SPyDGGRID

------------

How to use

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]]);

Supported Functions

Grid Creation

Grid Statistics

Grid Conversions

Changes

Slow development pace.

1.0.5

  • Added support to SeqNumGrid

Development

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.

Server the emscripten output [just for development purpuse]

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])
``