30

I am using ArcGIS 10, and I have layers of the 2010 Census blocks, block groups, and tracts. There are thousands of polygons in these layers.

I want to color them so that each is distinct from its neighbors, but all I can figure out is how to give each one a distinct color. The color of each polygon does not really matter; I just want to easily distinguish each from its neighbor by color, rather than with a border.

Or is that something you only see in an elementary school map of the 50 United States?

8
  • 9
    (+1) Technically, ArcGIS does provide distinct colors, because it can select them randomly among (I believe) a palette of 2^24 and therefore the chances of two neighbors getting exactly the same color are low. This suggests you really want to fix a small number of readily differentiable colors and assign them so no neighboring polygons get the same color. There's an algorithm to do this for five or more colors when all polygons are connected and simply connected. (Manifold has a built-in procedure to five-color any polygon layer :-).)
    – whuber
    Jun 8, 2012 at 18:02
  • 6
    There is also a plugin in QGIS called "topocolour" that provides this capability. You might be able to look at their code and build something yourself if you cannot find a canned utility in ArcGIS. Jun 8, 2012 at 18:16
  • 9
    I wrote the aforementioned topocolour plugin! I think it might struggle with thousands of polygons though, to work out all the adjacencies. I've also recently written a version in R just in case anyone wants to colour maps in R that way. I won't touch ArcGIS though!
    – Spacedman
    Jun 8, 2012 at 18:53
  • 2
    BTW, ArcGIS has efficient internal procedures now for computing polygon adjacencies. I recall doing all blocks within a state (about half a million of them) in about 30 minutes: 15 for calcs, 15 for writing the adjacency file. With newer machines the job would go 5-10 times faster. So you could have your R code chew on an adjacency file produced by ArcGIS, which sounds like an optimal way to use both platforms for this problem.
    – whuber
    Jun 8, 2012 at 19:45
  • 2
    "Four colors suffice" (someone had to say it).
    – user1462
    Jul 9, 2012 at 15:47

5 Answers 5

1

You are looking for a tool that can achieve the 4-colors theorem

I use FME for that purpose, but such script should exists in arcPy also.

0

Have you considered http://colorbrewer2.org/ I seem to remember a plugin for ArcGIS or QGis being available.

1
0

I have coded an ArcPy tool that assigns an attribute from the provided list to the polygons using a neighbourhood table so that no neighbours share the same color. It usually manages to use less than six colors using a simple graph coloring heuristic (or, if need be, it can assign the colors randomly, still respecting the neighbourhood).

The toolbox together with some documentation can be downloaded from http://geocite.ic.cz/coloring.zip.

1
0

Perform a Flood fill on the polygons in Python adding a set amount of colour change to a recursive call to the flood fill function, altering the colour as you go.

-2

you could apply symbology classification on a unique identifier/GWID field.

3
  • 9
    This won't guarantee a unique color across neighboring polygons
    – user3461
    Jun 21, 2012 at 20:02
  • It should be since the RGB value can range from 0 to 255 for each, meaning there is a vast array of combinations for the R, B, and G values. so technically your won't have the same hue, unless you have well over a billion unique records.
    – GISdork
    Jul 31, 2012 at 17:37
  • 4
    This technique won't guarantee that two adjacent polygons have dissimilar colors in order "to easily distinguish each [polygon] from its neighbor". Even though the RGB combinations are unique they may look very similar. So if two neighboring polygons are assigned similar values, it won't be easy/possible to tell them apart. Please see whuber's first comment on the original question.
    – user3461
    Jul 31, 2012 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.