geocolor - was geocolor.io
geocolor classifies data contained in geojson properties, and assigns color values based on the simplestyle-spec. This means that when your geojson is rendered in github, gists, mapbox, or other simplestyle-spec compliant renderers, you will get nice styles that help to visualize your data.
Install
npm install geocolor
Colors
The color gradient is defined by simply passing an array of colors with as many stops as you want.
Classification
Curently supported classifications:
- equal intervals
- quantiles
- jenks
Example
var geocolor = require('geocolor')
var cities = {
// [point data](https://github.com/morganherlocker/geocolor/blob/master/test/in/cities.geojson)
}
var z = 'Population',
classification = 'jenks', // 'quantile' and 'interval' also supported
numberOfBreaks = 5,
colors = ['green', 'yellow', 'red']
geo = geocolor(cities, z, classification, numberOfBreaks, colors)
// properties now contains style info with encoded colors
console.log(geo)
Dev
Running tests:
npm test