Skip to content

Playground

This page runs the real Miniset WebAssembly module — the same miniset.js + miniset.wasm you'd ship in your own project. Everything executes locally in your browser; nothing is sent to a server.

How it works

  • The module is already loaded and handed to your snippet as Miniset.
  • Call log(...) to print to the output panel (it accepts numbers and objects too).
  • await works — the code runs inside an async function.
  • Press Run (or ++ctrl+enter++ / ++cmd+enter++) to execute; Reset restores the sample.
  • Remember to .delete() any WASM objects you create.
Loading WASM…
// Compare the mean planetary radius of Mars, the Moon, and Earth using
// EllipsoidDEM (pure geometry — no data file required).
const bodies = [
  { name: "Mars",  a: 3396190, c: 3376200 },
  { name: "Moon",  a: 1737400, c: 1737400 },
  { name: "Earth", a: 6378137, c: 6356752 },
];

log("Radius from body centre, in metres:\n");
log("body    equator (0°)      pole (90°)");
log("-----   ---------------   ---------------");

for (const b of bodies) {
  const dem = new Miniset.EllipsoidDEM(b.a, b.c);
  const eq = dem.getRadius(0, 0).toFixed(1);
  const pole = dem.getRadius(90, 0).toFixed(1);
  log(`${b.name.padEnd(6)}  ${eq.padStart(15)}   ${pole.padStart(15)}`);
  dem.delete();
}
Ready — press Run.

Things to try

  • Swap in your own body: new Miniset.EllipsoidDEM(semiMajor, semiMinor).
  • Inspect the enum: log(Object.keys(Miniset.DEMType)).
  • Load a Cloud Optimized GeoTIFF over HTTP:

    const dem = new Miniset.GdalDEM(
      "/vsicurl/https://example.com/mars_dem.tif",
      Miniset.DEMType.HEIGHT
    );
    log(dem.getHeight(-4.0, 222.5));
    dem.delete();
    

    (Remote fetches need the host to allow cross-origin requests.)

See the API Reference for every class and method the module exposes.