1.0.1 • Published 9 years ago

turf-min v1.0.1

Weekly downloads
1,438
License
MIT
Repository
github
Last release
9 years ago

turf-min

build status

turf min module

turf.min(polygons, points, inField, outField)

Calculates the minimum value of a field for Point features within a set of Polygon features.

Parameters

parametertypedescription
polygonsFeatureCollectiona FeatureCollection of Polygon features
pointsFeatureCollectiona FeatureCollection of Point features
inFieldstringthe field in input data to analyze
outFieldstringthe field in which to store results

Example

var polygons = turf.featurecollection([
  turf.polygon([[
    [72.809658, 18.961818],
    [72.809658, 18.974805],
    [72.827167, 18.974805],
    [72.827167, 18.961818],
    [72.809658, 18.961818]
  ]]),
  turf.polygon([[
    [72.820987, 18.947043],
    [72.820987, 18.95922],
    [72.841243, 18.95922],
    [72.841243, 18.947043],
    [72.820987, 18.947043]
  ]])
]);
var points = turf.featurecollection([
  turf.point([72.814464, 18.971396], {population: 200}),
  turf.point([72.820043, 18.969772], {population: 600}),
  turf.point([72.817296, 18.964253], {population: 100}),
  turf.point([72.83575, 18.954837], {population: 200}),
  turf.point([72.828197, 18.95094], {population: 300})]);

var minimums = turf.min(
  polygons, points, 'population', 'min');

var result = turf.featurecollection(
  points.features.concat(minimums.features));

//=result

Installation

Requires nodejs.

$ npm install turf-min

Tests

$ npm test
1.0.1

9 years ago

1.0.0

9 years ago

0.1.2

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago