gis-tools-ts - v0.6.0
    Preparing search index...

    Function lanczosInterpolation

    • Lanczos Interpolation

      Perform interpolation using the Lanczos filter. This method uses a kernel-based approach to weigh contributions from nearby points, providing a balance between smoothing and sharpness.

      import { lanczosInterpolation, PointIndexFast } from 'gis-tools-ts';
      import type { VectorPoint } from 'gis-tools-ts';

      // We have m-value data that we want to interpolate
      interface TempData { temp: number; }

      const pointIndex = new PointIndexFast<TempData>();
      // add lots of points
      pointIndex.insertLonLat(lon, lat, data);
      // ....

      // given a point we are interested in
      const point: VectorPoint = { x: 20, y: -40 };
      // get a collection of points relative to the point
      const data = await pointIndex.searchRadius(point.x, point.y, radius);

      // interpolate
      const interpolatedValue = lanczosInterpolation<TempData>(point, data, (p) => p.m.temp);

      Type Parameters

      • T extends Properties = Properties

      Parameters

      • point: VectorPoint

        Point to interpolate

      • refData: VectorPoint<T>[]

        Reference data points

      • getValue: GetInterpolateValue<T> = defaultGetInterpolateCurrentValue

        Function to extract the value from a reference point

      • kernelRadius: number = 2

        Lanczos kernel radius (default is 2) Recommend to only use 2 or 3.

      Returns number

      • The interpolated value