import type { GetInterpolateValue } from './index.js'; import type { MValue, Properties, RGBA, VectorPoint } from '../../index.js'; /** * # Nearest Neighbor Interpolation * * ## Description * Finds the nearest point in the reference data to the given point and returns its value. * * ## Usage * ```ts * import { nearestInterpolation, 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(); * // 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 = nearestInterpolation(point, data, (p) => p.m.temp); * ``` * @param point - Point to interpolate * @param refData - Reference data to search from * @param getValue - Function to get value from reference data * defaults to function that returns the z value or 0 if the z value is undefined * @returns - The value of the nearest point */ export declare function nearestInterpolation(point: VectorPoint, refData: VectorPoint[], getValue?: GetInterpolateValue): number; /** * Helper function for {@link nearestInterpolation} on RGB(A) data. * Light in RGB data is logarithmically weighted, so we need to expand each component by n^2 to * get the correct weight for each component. * @param point - Point to interpolate * @param refData - Reference data points * @returns - The interpolated RGBA data. */ export declare function rgbaNearestInterpolation(point: VectorPoint, refData: VectorPoint[]): RGBA; //# sourceMappingURL=nearest.d.ts.map