[Mapserver-users] Different colors in different layers

Stephen Woodbridge woodbri at swoodbridge.com
Fri Jul 2 05:14:28 PDT 2004


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.




More information about the MapServer-users mailing list