# node-idw

> IDW interpolation for nodejs, C++ addon

Latest version **0.2.0** (published 2017-04-26) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install node-idw
pnpm add node-idw
yarn add node-idw
bun add node-idw
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-04-26 |
| First published | 2017-04-18 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 2 |
| Author | zszszsz |
| Maintainers | zszszsz |
| Keywords | idw, GIS |

## Links

- npm: https://www.npmjs.com/package/node-idw
- Repository: https://github.com/zszszsz/node-idw
- Homepage: https://github.com/zszszsz/node-idw#readme
- Issues: https://github.com/zszszsz/node-idw/issues
- npm.io page: https://npm.io/package/node-idw

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2017-04-26
- 0.1.2 — 2017-04-26
- 0.1.1 — 2017-04-26
- 0.1.0 — 2017-04-26
- 0.0.7 — 2017-04-26
- 0.0.6 — 2017-04-25
- 0.0.5 — 2017-04-25
- 0.0.4 — 2017-04-19
- 0.0.3 — 2017-04-19
- 0.0.2 — 2017-04-18

## README

# node-idw
inverse distance weighted interpolation for nodejs in C++
-----

````
var options = {
    nth: ?,
    same: ?,
    neighbor: ?,
    loLim: ?,
    upLim: ?
}
````
--------

**nth**: 

Nth power to calculate the weight from distance :

weight = distance^nth

Default value is **1**.

--------

**same**: 

Threshold of same point check : 

A **given point** will be considered as the **same point** of the **grid point**,

if the distance between them is **lower** than this threshold.

The **value** of the **grid point** will be set to the value of the given point,

And the interpolation process for this grid point will **stop immediately**.

Default value is **2 * DBL_MIN**.

--------


**neighbor**:

Threshold of neighborhood check :

A **given point** will **NOT** be considered a **neighbor** of the grid point,

if the distance between them is **larger** than this threshold.

Only neighbor points have effect on the grid point,

which means the given point will be **skiped** if it is not a neighbor.

Default value is **DBL_MAX**.

--------


**loLim**: 

Lower limit :

If the value of a given point is lower than this limit,
 
it will be **skiped**, **unless** it is **the same point** of the grid point.

Default value is **-DBL_MAX**.

--------

**upLim**: 

Upper limit. same.

Default value is **DBL_MAX**.

--------
````
const idw = require('idw')
...
points = [
    {value: 10, longitude: 11, latitude: 12},
    {value: 1, longitude: 2, latitude: 3},
    {value: 7, longitude: 8, latitude: 9},
    {value: 4, longitude: 5, latitude: 6},
    ...
]
x = Array.from({length: width}, (v,k)=> x(k))
y = Array.from({length: height}, (v,k)=> y(k))

var interpolated = idw.sync(points, x, y, [options])

callback = (interpolated) => {
    ...
}

idw.async(points, x, y, [options], callback)
````

or


````
const idw = require('idw')
value = [10,1,7,4,...]
x = [11,2,8,5,...]
y=[12,3,9,6,...]
X = Array.from({length: width}, (v,k)=> X(k))
Y = Array.from({length: height}, (v,k)=> Y(k))

var interpolated = idw.sync(value, x, y, X, Y, [options])

callback = (interpolated) => {
    ...
}

idw.async(value, x, y, X, Y, [options], callback)
````

---
_Source: https://npm.io/package/node-idw · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
