Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Color a GeoJSON FeatureCollection so that contiguous areas have different fills

Notifications You must be signed in to change notification settings

aaronpdennis/five-color-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

five-color-map

Color a GeoJSON FeatureCollection so that bordering areas never have the same fill. Five colors are all you'll need.

example

USA Congressional Districts

install

install with npm:

$ npm install --save five-color-map

command line

install with npm:

$ npm install -g five-color-map

then

$ fivecolormap data.geojson > colored-data.geojson

usage

var fiveColorMap = require('five-color-map');
var coloredGeoJSON = fiveColorMap(geojson);

Each feature in coloredGeoJSON.features now has a property fill with one of five values:

the five colors used by this package

caveat

At least one of your features must have less than 5 neighbors with adjacent sides. This won't work with a hexagonal grid.

About

Color a GeoJSON FeatureCollection so that contiguous areas have different fills

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published