项目作者: NicolaiMogensen

项目描述 :
Inverse Distance Weighting for JavaScript
高级语言: JavaScript
项目地址: git://github.com/NicolaiMogensen/Inverse-Distance-Weighting-JS.git
创建时间: 2016-10-28T09:45:59Z
项目社区:https://github.com/NicolaiMogensen/Inverse-Distance-Weighting-JS

开源协议:MIT License

下载


Inverse-Distance-Weighting-JS

Inverse Distance Weighting for JavaScript

Small JavaScript function that calculates an IDW and paints a grayscale canvas.

The algorithm is explained here: https://en.wikipedia.org/wiki/Inverse_distance_weighting

Function IDW:
Takes a boundingbox, canvas dimensions, a list of points, a power factor and an id which will be assigned to the canvas created by the IDW function

How to use:
Include script in your HTML head

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <script scr="idwJS.js"></script>
  5. ...
  6. </head>
  7. </body>
  8. </html>
  1. var idw = new IDW(bbox, dim, points, 2, "idw-canvas");
  2. idw.calculateMatrix();

Used for calculating IDW in my Three.js project. Uses UTM32 coordinates from air quality sensors. You might need to change some things if you want to use it in your own project (add css, or append the canvas to something other than the body)