[mapserver-users] dynamic coloring in mapserver?

Brent Fraser bfraser at geoanalytic.com
Thu Nov 4 14:33:58 PDT 2010


Mukesh

    As Bob pointed out you can "over-ride" the color in mapserver's map 
configuration file with a CGI variable.  You can also have the STYLE 
object in the map configuration file reference a color value stored as 
an attribute value in the DBF.  See http://mapserver.org/mapfile/style.html:

COLOR [r] [g] [b] | [attribute]

        *

          Color to use for drawing features.

        *

          [/Attribute/] was introduced in version 5.0, to specify the
          item name in the attribute table to use for color values. The
          hard brackets [] are required. For example, if your
          /shapefile/'s DBF has a field named "MYCOLOR" that holds color
          values for each record, your STYLE object for might contain:

          STYLE
             COLOR  [MYCOLOR]
             OUTLINECOLOR  150  150  150
          END

Or better yet store the geometry and attributes in a PostGIS database to 
avoid any file/record locking problems if you want the user to be able 
to persistently change the value.

Best Regards,
Brent Fraser

On 11/4/2010 3:21 PM, Mukesh Subedee wrote:
>
> Hi,
>
> I am new to map server. I have been playing with it and finding it 
> interesting. I have a shape file with database containing different 
> area (polygon) codes. Let's say I have x.dbf file for a x.shp file and 
> it contains a row with polygon code (I don't worry about layers).
>
> I want to color one or more area as desired by the user. e.g. If a 
> user desires to color area number 12 that corresponds to a region 
> (polygon) in the map, the desired area should be colored with specific 
> color.
>
> Is it possible to do such thing with MapServer? Is it possible to 
> dynamically assign specific color to the polygon area with it?
>
> Thanks a lot!
>
> Mukesh
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20101104/c7d76635/attachment.htm>


More information about the MapServer-users mailing list