change colors of raster images in mapfile

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

change colors of raster images in mapfile

Frank Rittinger
Hello list,

I have two b/w raster layers in a mapfile and would like to change the
foreground color of one of them from black to blue.

If I add class entries to the layers, both layers get displayed in the
same color.

After reading the raster howto, I got the impression that that's the
normal behavior because the same color in all images gets the same new
rgb value. Is this connected to color bands?

Any hints are welcomed,

regards

Frank Rittinger
Reply | Threaded
Open this post in threaded view
|

Re: change colors of raster images in mapfile

Flavio Hendry
Hi Frank

example (this is with an 8bit raster, EXPRESSION refers to the color
number). makes not to much sense to me on an 24bit raster:

        LAYER
                NAME "pk25"
                MINSCALE 0
                MAXSCALE 10000
                TYPE RASTER
                STATUS OFF
                TILEINDEX "../swisstopo/pk25"
                TILEITEM "LOCATION"
                TEMPLATE ttt.htm
                  CLASS
                    NAME "Weisser Hintergrund"
                    EXPRESSION "1"
                    COLOR 255 255 255
                  END
               
                  CLASS
                    NAME "Waldfl?che"
                    EXPRESSION "2"
                    COLOR 197 230 189
                  END


Mit freundlichem Gruss / Best Regards
Flavio Hendry

----------------------------------------------------------------
TYDAC NEWS http://www.tydac.ch/german/index.php?menu=News_actual
----------------------------------------------------------------
############ ? ? ?Mit freundlichen Gruessen / Kind Regards
############? ? ? ? ? ? ?mailto:[hidden email]
############ ? ? ? ? TYDAC AG - http://www.tydac.ch
#### ? ?#### ? ? ? ?Geographic Information Solutions
#### ? ?#### ? ? ? ? Luternauweg 12 -- CH-3006 Bern
############ ? Tel +41 (0)31 368 0180 - Fax +41 (0)31 368 1860
----------------------------------------------------------------


-----Original Message-----
From: Frank Rittinger <[hidden email]>
To: [hidden email]
Date: Wed, 7 Dec 2005 11:06:53 +0100
Subject: [UMN_MAPSERVER-USERS] change colors of raster images in mapfile

> Hello list,
>
> I have two b/w raster layers in a mapfile and would like to change
> the
> foreground color of one of them from black to blue.
>
> If I add class entries to the layers, both layers get displayed in
> the
> same color.
>
> After reading the raster howto, I got the impression that that's the
> normal behavior because the same color in all images gets the same
> new
> rgb value. Is this connected to color bands?
>
> Any hints are welcomed,
>
> regards
>
> Frank Rittinger
Reply | Threaded
Open this post in threaded view
|

Re: change colors of raster images in mapfile

Trond Michelsen-2
On Wed, Dec 07, 2005 at 01:09:57PM +0100, Flavio Hendry wrote:
> example (this is with an 8bit raster, EXPRESSION refers to the color
> number). makes not to much sense to me on an 24bit raster:

[...]

>  CLASS
>    NAME "Weisser Hintergrund"
>    EXPRESSION "1"
>    COLOR 255 255 255
>  END


Oooh. Thanks. I've been looking for that feature.

That's actually pretty useful even if you want to keep the
colors. Because when you define classes like this, they will show up
in the legend as well.

I only wish it was possible to hide unused classes from the legend.

--
Trond Michelsen
Reply | Threaded
Open this post in threaded view
|

Re: change colors of raster images in mapfile

Dylan Keon-3
On 12/7/05, Trond Michelsen <[hidden email]> wrote:

> On Wed, Dec 07, 2005 at 01:09:57PM +0100, Flavio Hendry wrote:
> > example (this is with an 8bit raster, EXPRESSION refers to the color
> > number). makes not to much sense to me on an 24bit raster:
>
> [...]
>
> >  CLASS
> >    NAME "Weisser Hintergrund"
> >    EXPRESSION "1"
> >    COLOR 255 255 255
> >  END
>
>
> Oooh. Thanks. I've been looking for that feature.
>
> That's actually pretty useful even if you want to keep the
> colors. Because when you define classes like this, they will show up
> in the legend as well.
>
> I only wish it was possible to hide unused classes from the legend.


If you remove the NAME from your class it won't appear in the legend.
If you need to do it dynamically you could use MapScript to set/unset
the NAME depending upon your condition.

--Dylan