How to use @turf/nearest-point - 3 common examples

To help you get started, we’ve selected a few @turf/nearest-point examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Turfjs / turf / packages / turf-nearest-neighbor-analysis / index.ts View on Github external
const observedMeanDistance = features.map((feature, index) => {
        const otherFeatures = featureCollection(features.filter((f, i) => {
            return i !== index;
        }));
        // Have to add the ! to make typescript validation pass
        // see https://stackoverflow.com/a/40350534/1979085
        return distance(feature, nearestPoint(feature, otherFeatures).geometry!.coordinates, {units});
    }).reduce((sum, value) => { return sum + value; }, 0) / n;
github Turfjs / turf / packages / turf-nearest-neighbor-analysis / index.js View on Github external
var observedMeanDistance = features.map(function (feature, index) {
        var otherFeatures = featureCollection(features.filter(function (f, i) {
            return i !== index;
        }));
        return distance(feature, nearestPoint(feature, otherFeatures), {units: units});
    }).reduce(function (sum, value) { return sum + value; }, 0) / n;
github cheeaun / taxirouter-sg / assets / turf-modules.js View on Github external
var helpers = require('@turf/helpers');

module.exports = {
  pointsWithinPolygon: require('@turf/points-within-polygon').default,
  nearestPoint: require('@turf/nearest-point').default,
  circle: require('@turf/circle').default,
  multiPoint: helpers.multiPoint,
  point: helpers.point,
  points: helpers.points,
  polygon: helpers.polygon,
};

@turf/nearest-point

turf nearest-point module

MIT
Latest version published 3 months ago

Package Health Score

94 / 100
Full package analysis

Popular @turf/nearest-point functions