turf-nearest

turf nearest module

Turf packages are now namespaced: please use @turf/nearest instead
Last updated 4 years ago by tmcw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install turf-nearest 
SYNC missed versions from official npm registry.

turf-nearest

build status

turf nearest module

turf.nearest(point, against)

Takes a Point feature and a FeatureCollection of Point features and returns the Point feature from the FeatureCollection closest to the input point.

Parameters

parameter type description
point Point the reference point
against FeatureCollection a FeatureCollection of Point features

Example

var point = turf.point([28.965797, 41.010086]);
point.properties['marker-color'] = '#0f0';
var against = turf.featurecollection([
 turf.point([28.973865, 41.011122]),
 turf.point([28.948459, 41.024204]),
 turf.point([28.938674, 41.013324])
]);

var nearest = turf.nearest(point, against);
nearest.properties['marker-color'] = '#f00';

var result = turf.featurecollection(
  against.features.concat(point));

//=result

Installation

Requires nodejs.

$ npm install turf-nearest

Tests

$ npm test

Current Tags

  • 3.0.7-canary.ae89c8b3                                ...           canary (4 years ago)
  • 3.0.12                                ...           latest (4 years ago)

14 Versions

  • 3.0.12 [deprecated]           ...           4 years ago
  • 3.0.10 [deprecated]           ...           4 years ago
  • 3.0.7-canary.ae89c8b3                                ...           4 years ago
  • 3.0.5 [deprecated]           ...           5 years ago
  • 3.0.1 [deprecated]           ...           5 years ago
  • 3.0.0-canary.7879bf6c                                ...           5 years ago
  • 3.0.0-canary.2f5f7167                                ...           5 years ago
  • 1.0.2 [deprecated]           ...           6 years ago
  • 1.0.1 [deprecated]           ...           6 years ago
  • 1.0.0 [deprecated]           ...           6 years ago
  • 0.1.3 [deprecated]           ...           6 years ago
  • 0.1.2 [deprecated]           ...           6 years ago
  • 0.1.1 [deprecated]           ...           6 years ago
  • 0.1.0 [deprecated]           ...           7 years ago
Downloads
Today 31
This Week 64
This Month 31
Last Day 33
Last Week 196
Last Month 818
Dependencies (1)
Dev Dependencies (2)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |