[Mapserver-users] Changing Colors in Map !!

Stephen Woodbridge woodbri at swoodbridge.com
Wed Jul 21 08:08:23 EDT 2004


Hi Satyajit,

Since the problem is that you are overflowing the browser lookup table 
there is not guarantee that this method will work. When I did this I 
have a few colors that were changing so I only used the dummy layers to 
protect them.

I also notice that you have a RASTER layer. It is possible that this is 
the layer that is using up all the colors. Try adding the following to 
any RASTER type LAYER
   PROCESSING "COLOR_MATCH_THRESHOLD=3"

http://lists.gis.umn.edu/pipermail/mapserver-dev/2003-February/000177.html

and see if that helps.

Satyajit wrote:

> 	
> Hi Steve and Andy,
>            I tried Steve's method of adding dummy layers to my map file.
> But I don't see any significant improvement in the "changing color"
> problem. My map still behaves the same. I am using a lot of colors in my
> map. Since I have some 39 layers in my map, there are more than 40
> unique colors used in the map (outline colors also count). Do I have to
> use these 40 colors in the dummy layers i.e. 40 dummy layers have to be
> created ?? I tried using only 10 dummy layers with only one class in
> each of them. Will my problem be solved if I use a single dummy layer
> with 40 classes added in it ? 
> The legend problem has been solved. As Steve used HTML legend stuff, I
> am also using a HTML legend stuff. Hence I have control over the legend.
> I can choose which layers to be shown in the legend. 		
> 	
> I am attaching my map file with this mail. The part of map file which
> Steve has given in his mail ( which is also in the bug list at this
> place http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=306) seems to be
> of a different version. When I tried to copy the same to my map file it
> didn't work. I just added a "Style" object in my "Class" object with
> only a color entity in it. Please have a look at the map file. 
> 
> Waiting for your replies.
> 
> Regards
> ~sat.
> 
> -----Original Message-----
> From: mapserver-users-admin at lists.gis.umn.edu
> [mailto:mapserver-users-admin at lists.gis.umn.edu] On Behalf Of ANDY
> CANFIELD
> Sent: Monday, July 19, 2004 6:50 PM
> To: woodbri at swoodbridge.com; satyajit.gantayat at aurovision.com
> Cc: girish.shewale at aurovision.com; mapserver-users at lists.gis.umn.edu
> Subject: Re: [Mapserver-users] Changing Colors in Map !!
> 
> 
> Yes, I believe there is a way to do what you want. I have a legend on
> the 
> side of my maps that I generate on the fly by looping through the layers
> of 
> the map and adding each layer to the legend as the loop progresses as
> check 
> boxes with the layer name so the user can turn off or on the layers.
> 
> This allows the legend to be dynamic so no matter what the layers are in
> any 
> map I always get a uniformly formatted legend with no code changes.
> 
> I have a cosmetic layer much like the layer you are describing that I
> use to 
> copy for placing geocoded points on the map. The users are geocoding
> from 
> multiple text files so I want different colored points for each file so
> they 
> can compare the results of the files. That's why I use copies of that 
> cosmetic layer so I can use it's symbols and only have to change the
> color.
> 
> I don't want the users to have access to these cosmetic layer copies
> that 
> are created on the fly. So I make that the first layer and my loop
> through 
> the layers starts at layer 1 rather than layer 0 so the first layer
> never 
> shows up in the legend. You could do the same thing with as many
> cosmetic or 
> contruction layers as you wanted just be sure to start your loop one
> beyond 
> the last "invisible" layer.
> 
> 
> 
>>From: Stephen Woodbridge <woodbri at swoodbridge.com>
>>To: Satyajit <satyajit.gantayat at aurovision.com>
>>CC: Girish <girish.shewale at aurovision.com>,        MapServer List 
>><mapserver-users at lists.gis.umn.edu>
>>Subject: Re: [Mapserver-users] Changing Colors in Map !!
>>Date: Mon, 19 Jul 2004 08:16:59 -0400
>>
>>You raise a good issue. I don't usually display legends, but have used 
>>HTML
>>Legend stuff that allows you a lot of control over your legends and I
> 
> think 
> 
>>you can eliminate layers on a named basis. which might work for you.
>>
>>Please add a comment to the bug referenced below about this problem. I 
>>hope
>>that the developers will tackle this problem but it helps to have a 
>>complete picture of the problem and issues and their work arounds.
>>
>>-Steve W
>>
>>Satyajit wrote:
>>
>>
>>>Hi Steve,
>>>      Thanks a lot for the info. I have not tried your method yet but
> 
> 
>>>shall try it very soon. And let you know the result. I have a question
> 
> 
>>>in my mind though. When we add a dummy layer in our map and add 
>>>classes to it ( to preserve the colors ..as you said), the layer will 
>>>be shown in the legend in the browser. That dummy layer in the legend 
>>>might confuse the end user as that layer's features won't be easily 
>>>visible in the map and of course that layer doesn't have much meaning 
>>>to it. Is there any way by which I can add that layer in my map file 
>>>with all the classes but still make it invisible in the legend ? 
>>>Thanks a lot again steve. Shall get back to you after modifying my map
> 
> 
>>>file.
>>>
>>>~sat
>>>
>>>Stephen Woodbridge wrote:
>>>
>>>
>>>
>>>>I think I may have created a feature and inserted a one pixel dot on 
>>>>the map that gets covers by later layers. Play with it and if you 
>>>>have a problem let me know and I can dig through old mapfiles and 
>>>>find out
>>>
>>>how
>>>
>>>
>>>>I did it.
>>>
>>>
>>>Here are some examples of preserving the colors in a symbol that were
>>>changing. The big problem with this approach is that it uses up a lot
> 
> of
> 
>>>layers, so you might try using one layer with lots of classes, but I'm
> 
> 
>>>not
>>>sure it that will work.
>>>
>>>The bug for this problem is:
>>>   http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=306
>>>I just updated it with this information.
>>>
>>>## dummy layer to protect symbol colors from changing
>>>   LAYER
>>>     NAME "color_symbol"
>>>     STATUS DEFAULT
>>>     TYPE point
>>>     TRANSFORM false
>>>     FEATURE
>>>       POINTS
>>>         1 1
>>>       END
>>>     END
>>>     CLASS
>>>       SYMBOL "color_symbol"
>>>       COLOR 0 0 0
>>>     END
>>>   END
>>>## protect other colors
>>>   LAYER
>>>     NAME blue
>>>     STATUS DEFAULT
>>>     TYPE point
>>>     TRANSFORM false
>>>     FEATURE
>>>       POINTS
>>>         1 1
>>>       END
>>>     END
>>>     CLASS
>>>       COLOR 0 0 255
>>>     END
>>>   END
>>>   LAYER
>>>     NAME green
>>>     STATUS DEFAULT
>>>     TYPE point
>>>     TRANSFORM false
>>>     FEATURE
>>>       POINTS
>>>         1 1
>>>       END
>>>     END
>>>     CLASS
>>>       COLOR 8 206 107
>>>     END
>>>   END
>>>
>>>
>>>
> 
> Satyajit wrote :
> 
> Dear Users,
>             Thanks a million to all the users who gave me their valuable
> suggestions while building site. Without the help of this group it would
> have been impossible for me to build such a nice site ( I hope you too
> find it nice). Though my map is smoothly running, I have a strange
> problem in my hands. The data layers in my map are changing colors while
> browsing through them. The change in color happens randomly at some zoom
> levels. At times the colors of the data layer match with the colors in
> the map. You can check out this site http://203.199.114.111/newham/ .
> Normally the data is shown in the color specified in the map file. But
> when I try to zoom in the data layers seem to take the colors of
> different other data layers. And it create a whole lot of confusion. I
> can't really find any reason for this. 
> Any ideas ? 
>  
>  
> Sat
> Sr. Specialist - GIS 




More information about the mapserver-users mailing list