mapbox/tilemill — Issue #969: Wishlist: Color solver
Author: mroswell
Created: 2011-11-30 15:48:47+00:00
State: open

In this example from Geography Class:

#country::fill[zoom>=0] {
[ADM0_A3='ABW'] { polygon-fill:@purple; }
[ADM0_A3='AFG'] { polygon-fill:@red; }
[ADM0_A3='AGO'] { polygon-fill:@yellow; }
[ADM0_A3='AIA'] { polygon-fill:@blue; }
[ADM0_A3='ALB'] { polygon-fill:@purple; }
[ADM0_A3='ALD'] { polygon-fill:@red; }
[ADM0_A3='AND'] { polygon-fill:@purple; }
[ADM0_A3='ARE'] { polygon-fill:@green; }

Those settings presuppose a lot of knowledge. In fact, the only way to determine those colors is to predetermine them. (I'm guessing these were taken from a paper map.)

Manifold software, MapInfo, and others offer tools that automatically determine how to solve the 5-color problem: coloring polygons so that no two adjacent colors are the same. (In theory, it's the 4-color problem, but that's very mathematically intensive, and doesn't even look that good, so most of these solvers use 5 or 6 colors)

For instance, here's some documentation from manifold

http://georeference.org/doc/drawing_color.htm

This sounds like it's beyond the scope of tilemill, since I suspect it's not aware of adjacency. But I figure: if I need a pretty, colorful map like Geography Class, I'd have to use one of the GIS systems to figure out the colors anyhow, in essence, creating a new column with a number reflecting the color. Trying to guess colors one at a time can work, but inevitably two adjacent polygons end up with the same colors... so it's a bit of a chase to do it manually.

(I'll address choropleth color ramps in separate issues.)