From: Ian T. <ijt...@gm...> - 2010-05-21 15:23:57
|
On Fri, May 21, 2010 at 6:12 AM, Andrea Aime <aa...@op...> wrote: > Michael Bedward ha scritto: >> Hello, >> >>> I'd like to fill the polygons with multiple colors such that adjacent >>> polygons don't have the same color. How can I do this ? >> >> Easiest answer - if number of polygons is small make them all >> different colors :) >> >> General answer... >> Theoretically you only need four colors to achieve what you want with any map... >> >> http://en.wikipedia.org/wiki/Four_color_theorem >> >> But it's actually better to have five colors because there is a much >> faster algorithm for this... >> >> http://en.wikipedia.org/wiki/Five_color_theorem#Linear_time_five-coloring_algorithm >> >> I'd be interested to hear if anyone on the list has already got an >> implementation of this. Perhaps some clever bit of GeoServer ? > > Nope, we don't have anything like that. As far as I can see this would > have to be done in pre-processing anyways, first a full scan of the > data and then assign the colors? > > A tool could be used to load the data, build a connectivity map, > assign the colors, and generate a SLD using FID filters to assign > the 5 colors to the different polygons. > I have a paper on how to create the adjacency graph (http://www.citeulike.org/group/9502/article/6600150) that is on my to do list (but quite low down it :-) I can mail a copy of the PDF to anyone who's interested. Ian -- Ian Turton |