8000 GitHub - turf-junkyard/turf-jenks
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

turf-junkyard/turf-jenks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

turf-jenks

build status

turf jenks module

turf.jenks(input, field, numberOfBreaks)

Takes a set of features and returns an array of the Jenks Natural breaks for a given property

Parameters

parameter type description
input FeatureCollection input features
field String the property in input on which to calculate Jenks natural breaks
numberOfBreaks Number number of classes in which to group the data

Example

var points = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "population": 200
      },
      "geometry": {
        "type": "Point",
        "coordinates": [49.859733, 40.400424]
      }
    }, {
      "type": "Feature",
      "properties": {
        "population": 600
      },
      "geometry": {
        "type": "Point",
        "coordinates": [49.83879, 40.401209]
      }
    }, {
      "type": "Feature",
      "properties": {
        "population": 100
      },
      "geometry": {
        "type": "Point",
        "coordinates": [49.817848, 40.376889]
      }
    }, {
      "type": "Feature",
      "properties": {
        "population": 200
      },
      "geometry": {
        "type": "Point",
        "coordinates": [49.840507, 40.386043]
      }
    }, {
      "type": "Feature",
      "properties": {
        "population": 300
      },
      "geometry": {
        "type": "Point",
        "coordinates": [49.854583, 40.37532]
      }
    }
  ]
};

var breaks = turf.jenks(points, 'population', 3);

//=breaks

Returns Array.<number>, the break number for each class plus the minimum and maximum values

Installation

Requires nodejs.

$ npm install turf-jenks

Tests

$ npm test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0