JS/WASM library to compute isolines and isobands (using GDAL-style pixel-boundary polygonization)
npm install @millcrest/polygonize-wasmWASM library for computing isolines, isobands, and GDAL-style polygon rasterization.
``bash`
npm install @millcrest/polygonize-wasm
Converts a raster grid to polygons where output boundaries align exactly with pixel edges (GDAL-style).
`js
import { polygonize } from '@millcrest/polygonize-wasm';
const data = [
1, 1, 2,
1, 2, 2,
3, 3, 2,
];
const result = polygonize(data, 3, 3);
// Returns GeoJSON FeatureCollection with one polygon per unique value
`
Computes filled contour polygons using marching squares interpolation.
`js
import { isobands } from '@millcrest/polygonize-wasm';
const data = [
0, 0, 0, 0,
0, 2, 2, 0,
0, 2, 2, 0,
0, 0, 0, 0,
];
const result = isobands(data, 4, 4, [0, 1.5, 3]);
`
Options:
`js
const options = {
use_quad_tree: false, // default: true
x_origin: 0, // default: 0
y_origin: 0, // default: 0
x_step: 1, // default: 1
y_step: 1, // default: 1
};
const result = isobands(data, 4, 4, [0, 1.5, 3], options);
`
Computes contour lines using marching squares interpolation.
`js
import { isolines } from '@millcrest/polygonize-wasm';
const result = isolines(data, 4, 4, [0, 1.5, 3]);
`
Same options as isobands.
`bash`
make build
`bash``
make test