jalbertbowden / geocolor

style geojson based on data classifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Geocolors SC Counties

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

Geocolors Continental US Pins 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

More Examples

Geocolors Rivers Example

Geocolors Choloropleth South Carolina County Poverty

Geocolors Map Pin Gradient 1

Geocolors Map Pin Gradient 2

About

style geojson based on data classifications

License:MIT License


Languages

Language:JavaScript 100.0%