[mapserver-users] Random color

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Wed Sep 22 16:24:40 PDT 2010


You didn't say what environment you're in. If PostGIS I suspect you could write a function to generate a random color string (either r g b or #hex) and then bind MapServer color values to the function output. The function would simply generate 3 random numbers between 1 and 255. In MapServer it'd be:

LAYER
  ...
  DATA "the_geom from (select *, myColorMaker() as mycolor from myTable)
  ...
  CLASS
    STYLE
      COLOR [mycolor]
      ...
    END
  END
END

I've not tried anything like this but it should work...

Steve

________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] On Behalf Of Ibrahim Saricicek [ibrahimsaricicek at gmail.com]
Sent: Wednesday, September 22, 2010 7:34 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Random color

Hi list,

Can I define random colors for each of objects in a table?
Or hhould I define classes for each of them?
(I don't want to use Quantum Gis styling and mapserver export.)

Thanks in advance...


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Random-color-tp5558894p5558894.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
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