[mapserver-users] Different color for each row and it's child

Fawcett, David David.Fawcett at state.mn.us
Mon Sep 15 10:50:55 EDT 2008


I would suggest creating a column in table A to store a color value and
pre-populating it.  You would want to store the RGB triplet (e.g. '255 0
0').  I assume that you could have some sort of a stored proc that gets
triggered when a new record gets added.  
 
Using the new attribute binding in MapServer 5, you could then just set
the feature color by specifying the column name in the style in your map
file layer definition.  
 
Something like:
 
STYLE
   COLOR [myColorColumn]
   OUTLINECOLOR 0 0 0
END
 
As soon as someone kicks the MapServer site server and it restarts, I
suggest looking at the map file reference document under style.  
 
Also, make sure that your color column is specified in the query in your
data statement.  
 
David.

	-----Original Message-----
	From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Lee Keel
	Sent: Monday, September 15, 2008 9:33 AM
	To: mapserver-users at lists.osgeo.org
	Subject: [mapserver-users] Different color for each row and it's
child
	
	

	I had a client request something that sounds really cool, but I
don't know how to do it (or if it is even possible in mapserver).

	 

	First, my setup:

	I am running MS4W 2.6 on windows xp against postgis 8.2
database.  I have table A that has anywhere from 4 to 35 rows.  And
table B which could have several hundred rows each relating back to one
of the rows from table A.

	 

	For Example:

	TableA

	 

	ID                            Name

	1                                             t

	2                                             t2

	3                                             t3

	4                                             t4

	 

	 

	TableB

	ID            ta_id                      Value

	1              1                              something

	2              1                              something else

	3              1                              test

	4              2                              foo

	5              2                              bar

	6              3                              done

	 

	Now my problem:

	The client would like to see all the rows rendered from tableA
as different colors.  These colors can be random, it doesn't matter.  On
top of this, they want to see all the associated rows in tableB as the
same color as their parent from tableA.

	 

	Can I add a column to tableA and use that as a value in the
mapfile for the style?  And if so, how?

	 

	I would greatly appreciate any help that anyone can provide.

	 

	Thanks in advance,

	Lee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080915/a9ea93cc/attachment.html


More information about the mapserver-users mailing list