[mapserver-users] color loop for attributes in map file
Stephen Woodbridge
woodbri at swoodbridge.com
Tue Oct 11 14:36:45 PDT 2011
On 10/11/2011 4:25 PM, Gery wrote:
> Is there a way to put a loop in a map file? the problem is that I have 500
> items, some of them composed of 20 to 50 sub-items, and I need to color them
> by item (so, 500 colors). I think the way should be to write a CLASS and
> STYLE for every item to solve this (so, 500 CLASS/STYLE thing), and that is
> crazy. Any help is grateful.
Gery,
I think you need to rethink this. 500 colors are way to many for the
human brain to differentiate. In fact 50 colors are probably too many to
be useful. So what kind of objects are you displaying? point, lines,
polygons?
You can use crosshatch patterns on polygons, or symbols or points, and
patterns for lines, but 500 are still probably too many for the eye to
differentiate in any useful way. This would be like a "Where's Waldo?"
picture where you have to find one matching pattern in 500.
If still think you need 500 colors, then you have some options that
already exist:
1. create a column in your data like "color" and assign it values like
#ffffff or whatever color you want to each item. Then in the mapfile
habe a single
LAYER
...
CLASS
...
STYLE
COLOR [color]
...
END
END
END
2. write a sctipt to generate 500 CLASS blocks for your colors. I think
1. will be much faster.
-Steve W
More information about the MapServer-users
mailing list