[Mapserver-users] Different colors in different layers

Javier Castillejo Montes jcastil1 at tragsa.es
Fri Jul 2 08:23:15 EDT 2004


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C4602F.609DE44A
Content-Type: text/plain;
	charset="iso-8859-1"

Oh thanks that looks fine... 

and... how about do it dinamically (i think it's said "on the fly"), I mean,
I have the color I need on a database field... how can I assign the "divi"
to his color at runtime.

Javier C.


-----Mensaje original-----
De: Stephen Woodbridge [mailto:woodbri at swoodbridge.com]
Enviado el: viernes, 02 de julio de 2004 14:14
Para: Javier Castillejo Montes
CC: Mapserver-users at lists.gis.umn.edu
Asunto: Re: [Mapserver-users] Different colors in different layers


Javier Castillejo Montes wrote:

> Hi!
>  
> First of all  Im very bad english writer (its not my language so please
> forgive my mistakes
>  
> and im really new at mapserver
>  
> I'll try to make myself clear
>  
> I have differents layers and one of then is a layer a field , this field
has
> various divisions(layer 1)  and inside each division(divi A) there is one
> more division (layer 1) (divi AA,AB,AC). Can anybody tell me how can I put
a
> different color for each diviA and a different color for divi   AA,AB,AC

Javier,

You will need to know what all the possible divi are then you can try 
something like the following:

LAYER
   NAME "your_layer"
   CLASSEXPRESSION "divi"  # set the attribute field name here
   DATA ...
   CLASS
     EXPRESSION "A"
     STYLE
       COLOR 255 0 0  # red
     END
   END
   CLASS
     EXPRESSION "AA"
     STYLE
       COLOR 0 255 0  # green
     END
   END
   ...
END

You will have to add the other stuff you need in the layers, classes and 
styles to make them complete, but this should give you the idea of how 
to do it.

EXPRESSION /^A/   # will select all "divi" starting with "A..."
EXPRESSION /^A|^B/ # will select all "divi" starting with "A..." or "B..."

-Steve W.


------_=_NextPart_001_01C4602F.609DE44A
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: [Mapserver-users] Different colors in different =
layers</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Oh thanks that looks fine... </FONT>
</P>

<P><FONT SIZE=3D2>and... how about do it dinamically (i think it's said =
&quot;on the fly&quot;), I mean, I have the color I need on a database =
field... how can I assign the &quot;divi&quot; to his color at =
runtime.</FONT></P>

<P><FONT SIZE=3D2>Javier C.</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Mensaje original-----</FONT>
<BR><FONT SIZE=3D2>De: Stephen Woodbridge [<A =
HREF=3D"mailto:woodbri at swoodbridge.com">mailto:woodbri at swoodbridge.com</=
A>]</FONT>
<BR><FONT SIZE=3D2>Enviado el: viernes, 02 de julio de 2004 =
14:14</FONT>
<BR><FONT SIZE=3D2>Para: Javier Castillejo Montes</FONT>
<BR><FONT SIZE=3D2>CC: Mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>Asunto: Re: [Mapserver-users] Different colors in =
different layers</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Javier Castillejo Montes wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; Hi!</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; First of all&nbsp; Im very bad english writer =
(its not my language so please</FONT>
<BR><FONT SIZE=3D2>&gt; forgive my mistakes</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; and im really new at mapserver</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; I'll try to make myself clear</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; I have differents layers and one of then is a =
layer a field , this field has</FONT>
<BR><FONT SIZE=3D2>&gt; various divisions(layer 1)&nbsp; and inside =
each division(divi A) there is one</FONT>
<BR><FONT SIZE=3D2>&gt; more division (layer 1) (divi AA,AB,AC). Can =
anybody tell me how can I put a</FONT>
<BR><FONT SIZE=3D2>&gt; different color for each diviA and a different =
color for divi&nbsp;&nbsp; AA,AB,AC</FONT>
</P>

<P><FONT SIZE=3D2>Javier,</FONT>
</P>

<P><FONT SIZE=3D2>You will need to know what all the possible divi are =
then you can try </FONT>
<BR><FONT SIZE=3D2>something like the following:</FONT>
</P>

<P><FONT SIZE=3D2>LAYER</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; NAME &quot;your_layer&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; CLASSEXPRESSION &quot;divi&quot;&nbsp; =
# set the attribute field name here</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; DATA ...</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; CLASS</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; EXPRESSION =
&quot;A&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; STYLE</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 255 0 =
0&nbsp; # red</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; END</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; END</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; CLASS</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; EXPRESSION =
&quot;AA&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; STYLE</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 0 255 =
0&nbsp; # green</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; END</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; END</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; ...</FONT>
<BR><FONT SIZE=3D2>END</FONT>
</P>

<P><FONT SIZE=3D2>You will have to add the other stuff you need in the =
layers, classes and </FONT>
<BR><FONT SIZE=3D2>styles to make them complete, but this should give =
you the idea of how </FONT>
<BR><FONT SIZE=3D2>to do it.</FONT>
</P>

<P><FONT SIZE=3D2>EXPRESSION /^A/&nbsp;&nbsp; # will select all =
&quot;divi&quot; starting with &quot;A...&quot;</FONT>
<BR><FONT SIZE=3D2>EXPRESSION /^A|^B/ # will select all =
&quot;divi&quot; starting with &quot;A...&quot; or =
&quot;B...&quot;</FONT>
</P>

<P><FONT SIZE=3D2>-Steve W.</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C4602F.609DE44A--



More information about the mapserver-users mailing list