[mapserver-users] One layer filled with 3 colors

Stephen Woodbridge woodbri at swoodbridge.com
Tue Apr 22 11:23:34 EDT 2008


Emilio Ponce wrote:
> Hi everyone,
> 
> I'm trying to paint one layer with 3 different colors, depending on
> one field called 'zona' that is a column of the table stored at a
> postGIS database. I'm doing this in the layer:
> 
>                 ...
> 		STATUS DEFAULT
> 		CONNECTIONTYPE postgis
> 		CONNECTION "host=**** dbname=**** user=**** password=**** port=****'"
> 		DATA "the_geom from car_marccata"
> 
> 	        FILTER "zona='FORA'"
> 		CLASS
> 			COLOR 143 81 8
> 		END
> 
> 		FILTER "zona='MAR'"
> 		CLASS
> 			COLOR 0 154 239
> 		END
> 
> 		FILTER "zona='CATA'"
> 		CLASS
> 			COLOR 223 223 223
> 		END
> 
> It doesn't works.. I've tried different strategies but I haven't found
> the problem yet. Does anyone knows what's wrong?
> 
> Thanks!
> 

Try this:

  		STATUS DEFAULT
  		CONNECTIONTYPE postgis
  		CONNECTION "host=**** dbname=**** user=**** assword=**** port=****'"
  		DATA "the_geom from car_marccata"
		CLASSITEM "zona"

  		CLASS
			EXPRESSION ([zona] = 'FORA')
  			COLOR 143 81 8
  		END

  		CLASS
			EXPRESSION ([zona] = 'MAR')
  			COLOR 0 154 239
  		END

  		CLASS
			EXPRESSION ([zona] = 'CATA')
  			COLOR 223 223 223
  		END


More information about the mapserver-users mailing list