[mapserver-users] Use of a Colortable

Fawcett, David David.Fawcett at state.mn.us
Wed Apr 15 06:28:26 PDT 2009


Heiko, 

Take a look at the map file documentation for the style of a class.  http://mapserver.org/mapfile/style.html#style

Look for COLOR.  You want to use the [attribute] option.  Instead of specifying a color for all of the features that fall into that class, you specify the name of an attribute column in your shapefile.  This attribute column should be a text column containing a 'RGB triplet', or three numeric values from 0-255 separated by spaces.  These values represent Red Green Blue.  (e.g. 255 0 255) 

Here is an example layer:

LAYER
  # set the symbol color based on a value in a column in the attribute table
  NAME "aqi_stations_color"    
  STATUS DEFAULT
  DATA 'aqiStations'  #this is the shapefile with the data
  TYPE POINT
  CLASS
    NAME 'AQI Stations'
    STYLE
      SYMBOL 'circle'
      SIZE 12
      COLOR [OUT_COLOR]   # OUT_COLOR is the shapefile column containing the color values
      OUTLINECOLOR 128 128 128
    END

  END


David.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Heiko Schröter
Sent: Wednesday, April 15, 2009 6:52 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Use of a Colortable


Hello,,

we are mapping global satellite data with postgis.

Is it possible with mapserver to change the color of the symbol according to 
the value read in from postgis ?
Now the color is fixed within the mapfile reading only the geolocations i.e.

LAYER
  CONNECTION "user=bla password=blub dbname=foo host=fum"
  DATA "geocenter from table1"
      CLASS
          COLOR 50 150 150
          SYMBOL "circle"
          SIZE 5
      END
END

My (maybe/probably ill) idea is something like:
...
DATA "value and geocenter from table1"
...
COLOR on value using "/dir/my_colortable.dat"
SYMBOL "circle"
...

But it looks like that only one coloumn of the GIS Table could be read for a 
given LAYER.DATA  statement.

Thanks for any suggestion.

Regards
Heiko
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list