UNPKG

node-red-contrib-tak-registration

Version:

A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK

36 lines (33 loc) 1.48 kB
import { FeatureCollection, Point, Feature, GeometryCollection, LineString, GeoJsonProperties } from 'geojson'; import { Units } from '@turf/helpers'; /** * Returns the closest {@link Point|point}, of a {@link FeatureCollection|collection} of points, * to a {@link LineString|line}. The returned point has a `dist` property indicating its distance to the line. * * @function * @param {FeatureCollection|GeometryCollection<Point>} points Point Collection * @param {Feature|Geometry<LineString>} line Line Feature * @param {Object} [options] Optional parameters * @param {string} [options.units='kilometers'] unit of the output distance property * (eg: degrees, radians, miles, or kilometers) * @param {Object} [options.properties={}] Translate Properties to Point * @returns {Feature<Point>} the closest point * @example * var pt1 = turf.point([0, 0]); * var pt2 = turf.point([0.5, 0.5]); * var points = turf.featureCollection([pt1, pt2]); * var line = turf.lineString([[1,1], [-1,1]]); * * var nearest = turf.nearestPointToLine(points, line); * * //addToMap * var addToMap = [nearest, line]; */ declare function nearestPointToLine<P = { dist: number; [key: string]: any; }>(points: FeatureCollection<Point> | Feature<GeometryCollection> | GeometryCollection, line: Feature<LineString> | LineString, options?: { units?: Units; properties?: GeoJsonProperties; }): Feature<Point, P>; export { nearestPointToLine as default, nearestPointToLine };