Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-reclass

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-reclass

turf reclass module

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55
increased by61.76%
Maintainers
8
Weekly downloads
 
Created
Source

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

parametertypedescription
inputFeatureCollectiona FeatureCollection of any type
inFieldstringthe field to translate
outFieldstringthe field in which to store translated results
translationsArray.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

Keywords

FAQs

Package last updated on 06 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc