turf-reclass
turf reclass module
Last updated 6 years ago by morganherlocker .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install turf-reclass 
SYNC missed versions from official npm registry.

turf-reclass

build status

turf reclass module

turf.reclass(input, inField, outField, translations)

Takes a FeatureCollection, an input field, an output field, and an array of translations and outputs an identical FeatureCollection with the output field property populated.

Parameters

parameter type description
input FeatureCollection a FeatureCollection of any type
inField string the field to translate
outField string the field in which to store translated results
translations Array.<number> an array of translations

Example

var points = turf.featurecollection([
  turf.point([13.170547, 32.888669], {population: 200}),
  turf.point([13.182048, 32.889533], {population: 600}),
  turf.point([13.17398, 32.882182], {population: 100}),
  turf.point([13.174324, 32.895011], {population: 200}),
  turf.point([13.185825, 32.884344], {population: 300})
]);
// 0 to 200 will map to "small", 200 to 400 will map to "medium", 400 to 600 will map to "large"
var translations = [
  [0, 200, "small"],
  [200, 400, "medium"],
  [400, 600, "large"]
];

var reclassed = turf.reclass(
  points, 'population', 'size', translations);

//=reclassed

Installation

Requires nodejs.

$ npm install turf-reclass

Tests

$ npm test

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

5 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |