Fork me on GitHub

Classify Data with ClassyBrew

Leaflet Code to Create Map

View storm_events GeoJSON Used in this Example
// create leaflet map
var map ='map').setView([37.8, -96], 3);

// Add basemap
L.tileLayer('http://stamen-tiles-{s}{z}/{x}/{y}.{ext}', {
	attribution: 'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap',
	subdomains: 'abcd',
	minZoom: 0,
	maxZoom: 20,
	ext: 'png'

// create classybrew object
var brew = new classyBrew();

// pass values from your geojson object into an empty array
// see link above to view geojson used in this example
var values = [];
for (var i = 0; i < storm_events.features.length; i++){
	if (storm_events.features[i].properties['PERCENT'] == null) continue;

// pass array to our classybrew series

// define number of classes

// set color ramp code

// classify by passing in statistical method
// i.e. equal_interval, jenks, quantile

// style function to return
// fill color based on brew.getColorInRange() method
function style(feature) {
	return {
		weight: 2,
		opacity: 1,
		color: 'white',
		dashArray: '3',
		fillOpacity: 0.7,
		fillColor: brew.getColorInRange(

// add geojson to map
// calling the style method on each feature
geojson = L.geoJson(storm_events, {
	style: style


ClassyBrew was created by TannerGeo as an Open Source solution to bulding thematic maps and graphics. It uses proven statistical methods and color theory palettes to help you represent your data faster and more accurately. If you find it helpful, please fork this repo and help improve it.