/wcontour-js

A JavaScript Library of wContour.

Primary LanguageTypeScriptGNU Lesser General Public License v3.0LGPL-3.0

wcontour-js

A JavaScript Library of wContour.

import { Contour, uti } from 'wcontour-js';

const contour = new Contour(data, x, y, undef);
const anlValues = [-10, 0, 10, 20, 30, 40];
const contours = contour.tracingContourLines(anlValues);
uti.smoothLines(contours);
const polygons = contour.tracingPolygons(contours, anlValues);

let lineFeatures = [];
for (let i = 0; i < contours.length; i++) {
  const line = contours[i];
  const feature = uti.getFeatureOfPoints("LineString", line);
  lineFeatures.push(feature);
}

let polyFeatures = [];
for (let polygon of polygons) {
  const polyline = polygon.outLine;
  let feature = uti.getFeatureOfPoints('Polygon', polyline, anlValues, polygon);
  polyFeatures.push(feature);
}