Takes a reference point and a FeatureCollection of Features with Point geometries and returns the point from the FeatureCollection closest to the reference. This calculation is geodesic.
var targetPoint = turf;var points = turf;var nearest = turf;//addToMapvar addToMap = targetPoint points nearest;nearestproperties'marker-color' = '#F00';
Install this module individually:
$ npm install @spatial/nearest-point
Or install the Turf module that includes it as a function:
$ npm install @turf/turf