3.0.12 • Published 9 years ago
turf-nearest v3.0.12
turf-nearest
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));
//=resultInstallation
Requires nodejs.
$ npm install turf-nearestTests
$ npm test3.0.12
9 years ago
3.0.10
10 years ago
3.0.7-canary.ae89c8b3
10 years ago
3.0.5
10 years ago
3.0.1
10 years ago
3.0.0-canary.7879bf6c
10 years ago
3.0.0-canary.2f5f7167
10 years ago
1.0.2
11 years ago
1.0.1
11 years ago
1.0.0
11 years ago
0.1.3
11 years ago
0.1.2
11 years ago
0.1.1
12 years ago
0.1.0
12 years ago
