[mapserver-users] Image with different colors for different polygons

Venkat Rao Tammineni vtammineni at roulacglobal.com
Mon Sep 29 23:58:47 EDT 2008


Hi,

  Try this...

# World Sub Regions Layer starts here
LAYER
NAME "Sub Regions" 
CONNECTIONTYPE POSTGIS
CONNECTION "host=192.168.1.158 dbname=GIS password=administrator
user=postgres port=5432"
DATA "the_geom from rgp_gis_subregions"


TYPE POLYGON
STATUS ON
LabelItem "ungs_csr"
ClassItem "ungs_csr"

 CLASS   NAME 'Antarctica'
           EXPRESSION 'Antarctica'
    	   COLOR 182 252 183
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

 END  # CLASS

 CLASS   NAME 'Australia and New Zealand'
           EXPRESSION 'Australia and New Zealand'
    	   COLOR 252 215 247
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS

   CLASS   NAME 'Central  Africa'
           EXPRESSION 'Central  Africa'
    	   COLOR 252 249 207
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end
   END  # CLASS


CLASS   NAME 'Central America'
           EXPRESSION 'Central America'
    	   COLOR 252 182 202
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

 END  # CLASS

 CLASS   NAME 'Central Asia'
           EXPRESSION 'Central Asia'
    	   COLOR 179 252 228
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end
  END  # CLASS

  CLASS   NAME 'East Asia'
           EXPRESSION 'East Asia'
    	   COLOR 252 192 239
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS

   CLASS   NAME 'Eastern Africa'
           EXPRESSION 'Eastern Africa'
    	   COLOR 252 190 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Eastern Europe'
           EXPRESSION 'Eastern Europe'
    	   COLOR 227 194 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Latin  America and Caribbean'
           EXPRESSION 'Latin  America and Caribbean'
    	   COLOR 217 212 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS
    CLASS   NAME 'Melanesia'
           EXPRESSION 'Melanesia'
    	   COLOR 222 252 215
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

     CLASS   NAME 'Northern  Africa'
           EXPRESSION 'Northern  Africa'
    	   COLOR 252 213 212
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	 END	# label end

      END  # CLASS

      CLASS   NAME 'Northern America'
           EXPRESSION 'Northern America'
    	   COLOR 252 234 215
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS
      CLASS   NAME 'Northern Asia and Eastern Europe'
           EXPRESSION 'Northern Asia and Eastern Europe'
    	   COLOR 184 179 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

      CLASS   NAME 'Northern Europe'
           EXPRESSION 'Northern Europe'
    	   COLOR 184 197 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

      END  # CLASS

      CLASS   NAME 'Polynesia'
           EXPRESSION 'Polynesia'
    	   COLOR 222 252 179
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS
   CLASS   NAME 'South America'
           EXPRESSION 'South America'
    	   COLOR  252 179 246
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'South Asia'
           EXPRESSION 'South Asia'
    	   COLOR 252 221 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

   END  # CLASS

      CLASS   NAME 'Southeast Asia'
           EXPRESSION 'Southeast Asia'
    	   COLOR  187 249 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS
    CLASS   NAME 'Southern  Africa'
           EXPRESSION 'Southern  Africa'
    	   COLOR 215 252 244
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Western  Africa'
           EXPRESSION 'Western  Africa'
    	   COLOR 252 245 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

    CLASS   NAME 'Western Europe'
           EXPRESSION 'Western Europe'
    	   COLOR 207 237 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

     END  # CLASS
  END # //end of the Sub region layer layer



Thanks and regards
# World Sub Regions Layer starts here
LAYER
NAME "Sub Regions" 
#CONNECTIONTYPE POSTGIS
#CONNECTION "host=192.168.1.158 dbname=GIS password=administrator
user=postgres port=5432"
#DATA "the_geom from rgp_gis_subregions"

CONNECTIONTYPE PLUGIN
PLUGIN
"D:\home\Vtammineni\Data\sandbox\gis\RoulacGis\plugins\msplugin_mssql2008.dl
l" #plug in
#CONNECTION
"server=192.168.1.79;uid=sa;pwd=asp123;database=testspatial;Integrated
Security=false"  # data base server connection
 CONNECTION
"server=RGPRTW74\SQLEXPRESS;uid=sa;pwd=asp123;database=gis;Integrated
Security=false"  # data base server connection
DATA "geom from rgp_gis_subregions" # table

TYPE POLYGON
STATUS ON
#MaxScale 77054330
#MinScale 66054330
#LABELMAXSCALE 55054330
#LABELMINSCALE 5433000
TRANSPARENCY 50
LabelItem "ungs_csr"
ClassItem "ungs_csr"

 CLASS   NAME 'Antarctica'
           EXPRESSION 'Antarctica'
    	   COLOR 182 252 183
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

 END  # CLASS

 CLASS   NAME 'Australia and New Zealand'
           EXPRESSION 'Australia and New Zealand'
    	   COLOR 252 215 247
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS

   CLASS   NAME 'Central  Africa'
           EXPRESSION 'Central  Africa'
    	   COLOR 252 249 207
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end
   END  # CLASS


CLASS   NAME 'Central America'
           EXPRESSION 'Central America'
    	   COLOR 252 182 202
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

 END  # CLASS

 CLASS   NAME 'Central Asia'
           EXPRESSION 'Central Asia'
    	   COLOR 179 252 228
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end
  END  # CLASS

  CLASS   NAME 'East Asia'
           EXPRESSION 'East Asia'
    	   COLOR 252 192 239
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS

   CLASS   NAME 'Eastern Africa'
           EXPRESSION 'Eastern Africa'
    	   COLOR 252 190 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Eastern Europe'
           EXPRESSION 'Eastern Europe'
    	   COLOR 227 194 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Latin  America and Caribbean'
           EXPRESSION 'Latin  America and Caribbean'
    	   COLOR 217 212 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS
    CLASS   NAME 'Melanesia'
           EXPRESSION 'Melanesia'
    	   COLOR 222 252 215
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

     CLASS   NAME 'Northern  Africa'
           EXPRESSION 'Northern  Africa'
    	   COLOR 252 213 212
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	 END	# label end

      END  # CLASS

      CLASS   NAME 'Northern America'
           EXPRESSION 'Northern America'
    	   COLOR 252 234 215
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS
      CLASS   NAME 'Northern Asia and Eastern Europe'
           EXPRESSION 'Northern Asia and Eastern Europe'
    	   COLOR 184 179 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

      CLASS   NAME 'Northern Europe'
           EXPRESSION 'Northern Europe'
    	   COLOR 184 197 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

      END  # CLASS

      CLASS   NAME 'Polynesia'
           EXPRESSION 'Polynesia'
    	   COLOR 222 252 179
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

   END  # CLASS
   CLASS   NAME 'South America'
           EXPRESSION 'South America'
    	   COLOR  252 179 246
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'South Asia'
           EXPRESSION 'South Asia'
    	   COLOR 252 221 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

   END  # CLASS

      CLASS   NAME 'Southeast Asia'
           EXPRESSION 'Southeast Asia'
    	   COLOR  187 249 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS
    CLASS   NAME 'Southern  Africa'
           EXPRESSION 'Southern  Africa'
    	   COLOR 215 252 244
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

    END  # CLASS

    CLASS   NAME 'Western  Africa'
           EXPRESSION 'Western  Africa'
    	   COLOR 252 245 182
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
	  END	# label end

      END  # CLASS

    CLASS   NAME 'Western Europe'
           EXPRESSION 'Western Europe'
    	   COLOR 207 237 252
           OUTLINECOLOR 110 110 110

	  LABEL  #label start
	    POSITION auto
	    SIZE SMALL
	    COLOR 255 25 25
          END	# label end

     END  # CLASS
  END # //end of the Sub region layer layer

Thanks And Regards,
Venkat.



-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Subha
Ramakrishnan
Sent: Monday, September 29, 2008 7:29 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Image with different colors for different
polygons

Hi,

I want to know if it is possible to color a polygon with different 
colors? For eg. If i've states of a country, i want to show each state 
with a different color.
Please let me know if it possible to do this. And if so what are the 
settings to be done for the same?

Thanks & regards,
Subha.
_______________________________________________
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